defgen.xsl 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <?xml version="1.0"?>
  2. <!--
  3. win32/defgen.xsl
  4. This stylesheet is used to transform doc/libxml2-api.xml into a pseudo-source,
  5. which can then be preprocessed to get the .DEF file for the Microsoft's linker.
  6. Use any XSLT processor to produce a file called libxml2.def.src in the win32
  7. subdirectory, for example, run xsltproc from the win32 subdirectory:
  8. xsltproc -o libxml2.def.src defgen.xsl ../doc/libxml2-api.xml
  9. Once that finishes, rest assured, the Makefile will know what to do with the
  10. generated file.
  11. April 2003, Igor Zlatkovic <igor@zlatkovic.com>
  12. -->
  13. <!DOCTYPE xsl:stylesheet [ <!ENTITY nl '&#xd;&#xa;'> ]>
  14. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  15. <xsl:strip-space elements="*"/>
  16. <xsl:output method="text"/>
  17. <xsl:template match="/">
  18. <xsl:text>#define LIBXML2_COMPILING_MSCCDEF&nl;</xsl:text>
  19. <xsl:text>#include "../include/libxml/xmlversion.h"&nl;</xsl:text>
  20. <xsl:text>LIBRARY libxml2&nl;</xsl:text>
  21. <xsl:text>EXPORTS&nl;</xsl:text>
  22. <xsl:for-each select="/api/symbols/*[self::variable or self::function]">
  23. <!-- Basic tests -->
  24. <xsl:if test="@file = 'c14n'">
  25. <xsl:text>#ifdef LIBXML_C14N_ENABLED&nl;</xsl:text>
  26. </xsl:if>
  27. <xsl:if test="@file = 'catalog'">
  28. <xsl:text>#ifdef LIBXML_CATALOG_ENABLED&nl;</xsl:text>
  29. </xsl:if>
  30. <xsl:if test="@file = 'debugXML'">
  31. <xsl:text>#ifdef LIBXML_DEBUG_ENABLED&nl;</xsl:text>
  32. </xsl:if>
  33. <xsl:if test="@file = 'DOCBparser'">
  34. <xsl:text>#ifdef LIBXML_DOCB_ENABLED&nl;</xsl:text>
  35. </xsl:if>
  36. <xsl:if test="(@file = 'HTMLparser')
  37. or (@file = 'HTMLtree')">
  38. <xsl:text>#ifdef LIBXML_HTML_ENABLED&nl;</xsl:text>
  39. </xsl:if>
  40. <xsl:if test="@file = 'nanohttp'">
  41. <xsl:text>#ifdef LIBXML_HTTP_ENABLED&nl;</xsl:text>
  42. </xsl:if>
  43. <xsl:if test="@file = 'nanoftp'">
  44. <xsl:text>#ifdef LIBXML_FTP_ENABLED&nl;</xsl:text>
  45. </xsl:if>
  46. <xsl:if test="(@file = 'relaxng')
  47. or (@file = 'xmlschemas')
  48. or (@file = 'xmlschemastypes')">
  49. <xsl:text>#ifdef LIBXML_SCHEMAS_ENABLED&nl;</xsl:text>
  50. </xsl:if>
  51. <xsl:if test="@file = 'xinclude'">
  52. <xsl:text>#ifdef LIBXML_XINCLUDE_ENABLED&nl;</xsl:text>
  53. </xsl:if>
  54. <xsl:if test="@file = 'xlink'">
  55. <xsl:text>#ifdef LIBXML_XLINK_ENABLED&nl;</xsl:text>
  56. </xsl:if>
  57. <xsl:if test="@file = 'xmlautomata'">
  58. <xsl:text>#ifdef LIBXML_AUTOMATA_ENABLED&nl;</xsl:text>
  59. </xsl:if>
  60. <xsl:if test="(@file = 'xmlregexp')
  61. or (@file = 'xmlunicode')">
  62. <xsl:text>#ifdef LIBXML_REGEXP_ENABLED&nl;</xsl:text>
  63. </xsl:if>
  64. <xsl:if test="(@file = 'xpath')
  65. or (@file = 'xpathInternals')">
  66. <xsl:text>#ifdef LIBXML_XPATH_ENABLED&nl;</xsl:text>
  67. </xsl:if>
  68. <xsl:if test="@file = 'xpointer'">
  69. <xsl:text>#ifdef LIBXML_XPTR_ENABLED&nl;</xsl:text>
  70. </xsl:if>
  71. <!-- Extended tests -->
  72. <xsl:if test="(@name = 'htmlDefaultSAXHandlerInit')
  73. or (@name = 'htmlInitAutoClose')
  74. or (@name = 'htmlCreateFileParserCtxt')
  75. or (@name = 'inithtmlDefaultSAXHandler')
  76. or (@name = 'xmlIsXHTML')
  77. or (@name = 'xmlIOHTTPOpenW')
  78. or (@name = 'xmlRegisterHTTPPostCallbacks')
  79. or (@name = 'xmlIOHTTPMatch')
  80. or (@name = 'xmlIOHTTPOpen')
  81. or (@name = 'xmlIOHTTPRead')
  82. or (@name = 'xmlIOHTTPClose')">
  83. <xsl:text>#ifdef LIBXML_HTML_ENABLED&nl;</xsl:text>
  84. </xsl:if>
  85. <xsl:if test="(@name = 'docbDefaultSAXHandlerInit')
  86. or (@name = 'initdocbDefaultSAXHandler')">
  87. <xsl:text>#ifdef LIBXML_DOCB_ENABLED&nl;</xsl:text>
  88. </xsl:if>
  89. <xsl:if test="@name = 'xmlValidBuildContentModel'">
  90. <xsl:text>#ifdef LIBXML_REGEXP_ENABLED&nl;</xsl:text>
  91. </xsl:if>
  92. <xsl:if test="(@name = 'xmlIOFTPMatch')
  93. or (@name = 'xmlIOFTPOpen')
  94. or (@name = 'xmlIOFTPRead')
  95. or (@name = 'xmlIOFTPClose')">
  96. <xsl:text>#ifdef LIBXML_FTP_ENABLED&nl;</xsl:text>
  97. </xsl:if>
  98. <xsl:if test="(@name = 'xmlTextReaderRelaxNGValidate')
  99. or (@name = 'xmlTextReaderRelaxNGSetSchema')">
  100. <xsl:text>#ifdef LIBXML_SCHEMAS_ENABLED&nl;</xsl:text>
  101. </xsl:if>
  102. <xsl:if test="(@name = 'xmlXPathDebugDumpObject')
  103. or (@name = 'xmlXPathDebugDumpCompExpr')">
  104. <xsl:text>#ifdef LIBXML_DEBUG_ENABLED&nl;</xsl:text>
  105. </xsl:if>
  106. <xsl:if test="(@name = 'xmlMallocLoc')
  107. or (@name = 'xmlMallocAtomicLoc')
  108. or (@name = 'xmlReallocLoc')
  109. or (@name = 'xmlMemStrdupLoc')">
  110. <xsl:text>#ifdef DEBUG_MEMORY_LOCATION&nl;</xsl:text>
  111. </xsl:if>
  112. <!-- Symbol -->
  113. <xsl:choose>
  114. <xsl:when test="(@name = 'xmlMalloc')
  115. or (@name = 'xmlMallocAtomic')
  116. or (@name = 'xmlRealloc')
  117. or (@name = 'xmlFree')
  118. or (@name = 'xmlMemStrdup')">
  119. <xsl:text>#ifdef LIBXML_THREAD_ALLOC_ENABLED&nl;</xsl:text>
  120. <xsl:text>__</xsl:text>
  121. <xsl:value-of select="@name"/>
  122. <xsl:text>&nl;</xsl:text>
  123. <xsl:text>#else&nl;</xsl:text>
  124. <xsl:value-of select="@name"/>
  125. <xsl:text> DATA&nl;</xsl:text>
  126. <xsl:text>#endif&nl;</xsl:text>
  127. </xsl:when>
  128. <xsl:when test="(@name = 'docbDefaultSAXHandler')
  129. or (@name = 'htmlDefaultSAXHandler')
  130. or (@name = 'oldXMLWDcompatibility')
  131. or (@name = 'xmlBufferAllocScheme')
  132. or (@name = 'xmlDefaultBufferSize')
  133. or (@name = 'xmlDefaultSAXHandler')
  134. or (@name = 'xmlDefaultSAXLocator')
  135. or (@name = 'xmlDoValidityCheckingDefaultValue')
  136. or (@name = 'xmlGenericError')
  137. or (@name = 'xmlGenericErrorContext')
  138. or (@name = 'xmlGetWarningsDefaultValue')
  139. or (@name = 'xmlIndentTreeOutput')
  140. or (@name = 'xmlTreeIndentString')
  141. or (@name = 'xmlKeepBlanksDefaultValue')
  142. or (@name = 'xmlLineNumbersDefaultValue')
  143. or (@name = 'xmlLoadExtDtdDefaultValue')
  144. or (@name = 'xmlParserDebugEntities')
  145. or (@name = 'xmlParserVersion')
  146. or (@name = 'xmlPedanticParserDefaultValue')
  147. or (@name = 'xmlSaveNoEmptyTags')
  148. or (@name = 'xmlSubstituteEntitiesDefaultValue')
  149. or (@name = 'xmlRegisterNodeDefaultValue')
  150. or (@name = 'xmlDeregisterNodeDefaultValue')">
  151. <xsl:text>#ifdef LIBXML_THREAD_ENABLED&nl;</xsl:text>
  152. <xsl:if test="@name = 'docbDefaultSAXHandler'">
  153. <xsl:text>#ifdef LIBXML_DOCB_ENABLED&nl;</xsl:text>
  154. </xsl:if>
  155. <xsl:if test="@name = 'htmlDefaultSAXHandler'">
  156. <xsl:text>#ifdef LIBXML_HTML_ENABLED&nl;</xsl:text>
  157. </xsl:if>
  158. <xsl:text>__</xsl:text>
  159. <xsl:value-of select="@name"/>
  160. <xsl:text>&nl;</xsl:text>
  161. <xsl:if test="@name = 'docbDefaultSAXHandler'">
  162. <xsl:text>#endif&nl;</xsl:text>
  163. </xsl:if>
  164. <xsl:if test="@name = 'htmlDefaultSAXHandler'">
  165. <xsl:text>#endif&nl;</xsl:text>
  166. </xsl:if>
  167. <xsl:text>#else&nl;</xsl:text>
  168. <xsl:if test="@name = 'docbDefaultSAXHandler'">
  169. <xsl:text>#ifdef LIBXML_DOCB_ENABLED&nl;</xsl:text>
  170. </xsl:if>
  171. <xsl:if test="@name = 'htmlDefaultSAXHandler'">
  172. <xsl:text>#ifdef LIBXML_HTML_ENABLED&nl;</xsl:text>
  173. </xsl:if>
  174. <xsl:value-of select="@name"/>
  175. <xsl:text> DATA&nl;</xsl:text>
  176. <xsl:if test="@name = 'docbDefaultSAXHandler'">
  177. <xsl:text>#endif&nl;</xsl:text>
  178. </xsl:if>
  179. <xsl:if test="@name = 'htmlDefaultSAXHandler'">
  180. <xsl:text>#endif&nl;</xsl:text>
  181. </xsl:if>
  182. <xsl:text>#endif&nl;</xsl:text>
  183. </xsl:when>
  184. <xsl:otherwise>
  185. <xsl:value-of select="@name"/>
  186. <xsl:if test="self::variable">
  187. <xsl:text> DATA</xsl:text>
  188. </xsl:if>
  189. <xsl:text>&nl;</xsl:text>
  190. </xsl:otherwise>
  191. </xsl:choose>
  192. <!-- Basic tests (close) -->
  193. <xsl:if test="@file = 'c14n'">
  194. <xsl:text>#endif&nl;</xsl:text>
  195. </xsl:if>
  196. <xsl:if test="@file = 'catalog'">
  197. <xsl:text>#endif&nl;</xsl:text>
  198. </xsl:if>
  199. <xsl:if test="@file = 'debugXML'">
  200. <xsl:text>#endif&nl;</xsl:text>
  201. </xsl:if>
  202. <xsl:if test="@file = 'DOCBparser'">
  203. <xsl:text>#endif&nl;</xsl:text>
  204. </xsl:if>
  205. <xsl:if test="(@file = 'HTMLparser')
  206. or (@file = 'HTMLtree')">
  207. <xsl:text>#endif&nl;</xsl:text>
  208. </xsl:if>
  209. <xsl:if test="@file = 'nanohttp'">
  210. <xsl:text>#endif&nl;</xsl:text>
  211. </xsl:if>
  212. <xsl:if test="@file = 'nanoftp'">
  213. <xsl:text>#endif&nl;</xsl:text>
  214. </xsl:if>
  215. <xsl:if test="(@file = 'relaxng')
  216. or (@file = 'xmlschemas')
  217. or (@file = 'xmlschemastypes')">
  218. <xsl:text>#endif&nl;</xsl:text>
  219. </xsl:if>
  220. <xsl:if test="@file = 'xinclude'">
  221. <xsl:text>#endif&nl;</xsl:text>
  222. </xsl:if>
  223. <xsl:if test="@file = 'xlink'">
  224. <xsl:text>#endif&nl;</xsl:text>
  225. </xsl:if>
  226. <xsl:if test="@file = 'xmlautomata'">
  227. <xsl:text>#endif&nl;</xsl:text>
  228. </xsl:if>
  229. <xsl:if test="(@file = 'xmlregexp')
  230. or (@file = 'xmlunicode')">
  231. <xsl:text>#endif&nl;</xsl:text>
  232. </xsl:if>
  233. <xsl:if test="(@file = 'xpath')
  234. or (@file = 'xpathInternals')">
  235. <xsl:text>#endif&nl;</xsl:text>
  236. </xsl:if>
  237. <xsl:if test="@file = 'xpointer'">
  238. <xsl:text>#endif&nl;</xsl:text>
  239. </xsl:if>
  240. <!-- Extended tests (close) -->
  241. <xsl:if test="(@name = 'htmlDefaultSAXHandlerInit')
  242. or (@name = 'htmlInitAutoClose')
  243. or (@name = 'htmlCreateFileParserCtxt')
  244. or (@name = 'inithtmlDefaultSAXHandler')
  245. or (@name = 'xmlIsXHTML')
  246. or (@name = 'xmlIOHTTPOpenW')
  247. or (@name = 'xmlRegisterHTTPPostCallbacks')
  248. or (@name = 'xmlIOHTTPMatch')
  249. or (@name = 'xmlIOHTTPOpen')
  250. or (@name = 'xmlIOHTTPRead')
  251. or (@name = 'xmlIOHTTPClose')">
  252. <xsl:text>#endif&nl;</xsl:text>
  253. </xsl:if>
  254. <xsl:if test="(@name = 'docbDefaultSAXHandlerInit')
  255. or (@name = 'initdocbDefaultSAXHandler')">
  256. <xsl:text>#endif&nl;</xsl:text>
  257. </xsl:if>
  258. <xsl:if test="@name = 'xmlValidBuildContentModel'">
  259. <xsl:text>#endif&nl;</xsl:text>
  260. </xsl:if>
  261. <xsl:if test="(@name = 'xmlIOFTPMatch')
  262. or (@name = 'xmlIOFTPOpen')
  263. or (@name = 'xmlIOFTPRead')
  264. or (@name = 'xmlIOFTPClose')">
  265. <xsl:text>#endif&nl;</xsl:text>
  266. </xsl:if>
  267. <xsl:if test="(@name = 'xmlTextReaderRelaxNGValidate')
  268. or (@name = 'xmlTextReaderRelaxNGSetSchema')">
  269. <xsl:text>#endif&nl;</xsl:text>
  270. </xsl:if>
  271. <xsl:if test="(@name = 'xmlXPathDebugDumpObject')
  272. or (@name = 'xmlXPathDebugDumpCompExpr')">
  273. <xsl:text>#endif&nl;</xsl:text>
  274. </xsl:if>
  275. <xsl:if test="(@name = 'xmlMallocLoc')
  276. or (@name = 'xmlMallocAtomicLoc')
  277. or (@name = 'xmlReallocLoc')
  278. or (@name = 'xmlMemStrdupLoc')">
  279. <xsl:text>#endif&nl;</xsl:text>
  280. </xsl:if>
  281. </xsl:for-each>
  282. </xsl:template>
  283. </xsl:stylesheet>