summaryrefslogtreecommitdiff
path: root/win32/defgen.xsl
blob: a598ff19e5d48d3b9a0309aa608a817c5faeb97a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<?xml version="1.0"?>
<!-- 
	win32/defgen.xsl
	This stylesheet is used to transform doc/libxml2-api.xml into a pseudo-source,
	which can then be preprocessed to get the .DEF file for the Microsoft's linker.
	
	Use any XSLT processor to produce a file called libxml2.def.src in the win32
	subdirectory, for example, run xsltproc from the win32 subdirectory:
	
	  xsltproc -o libxml2.def.src defgen.xsl ../doc/libxml2-api.xml
	  
	Once that finishes, rest assured, the Makefile will know what to do with the
	generated file. 

	April 2003, Igor Zlatkovic <igor@zlatkovic.com>
-->
<!DOCTYPE xsl:stylesheet [ <!ENTITY nl '&#xd;&#xa;'> ]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:strip-space elements="*"/>
	<xsl:output method="text"/>
	<xsl:template match="/">
		<xsl:text>#define LIBXML2_COMPILING_MSCCDEF&nl;</xsl:text>
		<xsl:text>#include "../include/libxml/xmlversion.h"&nl;</xsl:text>
		<xsl:text>LIBRARY libxml2&nl;</xsl:text>
		<xsl:text>EXPORTS&nl;</xsl:text>
		<xsl:for-each select="/api/symbols/*[self::variable or self::function]">
			<!-- Basic tests -->
			<xsl:if test="@file = 'c14n'">
				<xsl:text>#ifdef LIBXML_C14N_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@file = 'catalog'">
				<xsl:text>#ifdef LIBXML_CATALOG_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@file = 'debugXML'">
				<xsl:text>#ifdef LIBXML_DEBUG_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@file = 'DOCBparser'">
				<xsl:text>#ifdef LIBXML_DOCB_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="(@file = 'HTMLparser') 
					or (@file = 'HTMLtree')">
				<xsl:text>#ifdef LIBXML_HTML_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@file = 'nanohttp'">
				<xsl:text>#ifdef LIBXML_HTTP_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@file = 'nanoftp'">
				<xsl:text>#ifdef LIBXML_FTP_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="(@file = 'relaxng') 
					or (@file = 'xmlschemas') 
					or (@file = 'xmlschemastypes')">
				<xsl:text>#ifdef LIBXML_SCHEMAS_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@file = 'xinclude'">
				<xsl:text>#ifdef LIBXML_XINCLUDE_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@file = 'xlink'">
				<xsl:text>#ifdef LIBXML_XLINK_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@file = 'xmlautomata'">
				<xsl:text>#ifdef LIBXML_AUTOMATA_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="(@file = 'xmlregexp') 
					or (@file = 'xmlunicode')">
				<xsl:text>#ifdef LIBXML_REGEXP_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="(@file = 'xpath') 
					or (@file = 'xpathInternals')">
				<xsl:text>#ifdef LIBXML_XPATH_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@file = 'xpointer'">
				<xsl:text>#ifdef LIBXML_XPTR_ENABLED&nl;</xsl:text>
			</xsl:if>
			<!-- Extended tests -->
			<xsl:if test="(@name = 'htmlDefaultSAXHandlerInit') 
					or (@name = 'htmlInitAutoClose') 
					or (@name = 'htmlCreateFileParserCtxt') 
					or (@name = 'inithtmlDefaultSAXHandler')
					or (@name = 'xmlIsXHTML') 
					or (@name = 'xmlIOHTTPOpenW') 
					or (@name = 'xmlRegisterHTTPPostCallbacks') 
					or (@name = 'xmlIOHTTPMatch')
					or (@name = 'xmlIOHTTPOpen') 
					or (@name = 'xmlIOHTTPRead') 
					or (@name = 'xmlIOHTTPClose')">
				<xsl:text>#ifdef LIBXML_HTML_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="(@name = 'docbDefaultSAXHandlerInit') 
					or (@name = 'initdocbDefaultSAXHandler')">
				<xsl:text>#ifdef LIBXML_DOCB_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@name = 'xmlValidBuildContentModel'">
				<xsl:text>#ifdef LIBXML_REGEXP_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="(@name = 'xmlIOFTPMatch') 
					or (@name = 'xmlIOFTPOpen') 
					or (@name = 'xmlIOFTPRead') 
					or (@name = 'xmlIOFTPClose')">
				<xsl:text>#ifdef LIBXML_FTP_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="(@name = 'xmlTextReaderRelaxNGValidate') 
					or (@name = 'xmlTextReaderRelaxNGSetSchema')">
				<xsl:text>#ifdef LIBXML_SCHEMAS_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="(@name = 'xmlXPathDebugDumpObject') 
					or (@name = 'xmlXPathDebugDumpCompExpr')">
				<xsl:text>#ifdef LIBXML_DEBUG_ENABLED&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="(@name = 'xmlMallocLoc') 
					or (@name = 'xmlMallocAtomicLoc') 
					or (@name = 'xmlReallocLoc') 
					or (@name = 'xmlMemStrdupLoc')">
				<xsl:text>#ifdef DEBUG_MEMORY_LOCATION&nl;</xsl:text>
			</xsl:if>
			<!-- Symbol -->
			<xsl:choose>
				<xsl:when test="(@name = 'xmlMalloc') 
						or (@name = 'xmlMallocAtomic') 
						or (@name = 'xmlRealloc') 
						or (@name = 'xmlFree') 
						or (@name = 'xmlMemStrdup')">
					<xsl:text>#ifdef LIBXML_THREAD_ALLOC_ENABLED&nl;</xsl:text>
					<xsl:text>__</xsl:text>
					<xsl:value-of select="@name"/>
					<xsl:text>&nl;</xsl:text>
					<xsl:text>#else&nl;</xsl:text>
					<xsl:value-of select="@name"/>
					<xsl:text> DATA&nl;</xsl:text>
					<xsl:text>#endif&nl;</xsl:text>
				</xsl:when>
				<xsl:when test="(@name = 'docbDefaultSAXHandler') 
						or (@name = 'htmlDefaultSAXHandler') 
						or (@name = 'oldXMLWDcompatibility') 
						or (@name = 'xmlBufferAllocScheme') 
						or (@name = 'xmlDefaultBufferSize') 
						or (@name = 'xmlDefaultSAXHandler') 
						or (@name = 'xmlDefaultSAXLocator') 
						or (@name = 'xmlDoValidityCheckingDefaultValue') 
						or (@name = 'xmlGenericError') 
						or (@name = 'xmlGenericErrorContext') 
						or (@name = 'xmlGetWarningsDefaultValue') 
						or (@name = 'xmlIndentTreeOutput') 
						or (@name = 'xmlTreeIndentString') 
						or (@name = 'xmlKeepBlanksDefaultValue') 
						or (@name = 'xmlLineNumbersDefaultValue') 
						or (@name = 'xmlLoadExtDtdDefaultValue') 
						or (@name = 'xmlParserDebugEntities') 
						or (@name = 'xmlParserVersion') 
						or (@name = 'xmlPedanticParserDefaultValue') 
						or (@name = 'xmlSaveNoEmptyTags') 
						or (@name = 'xmlSubstituteEntitiesDefaultValue') 
						or (@name = 'xmlRegisterNodeDefaultValue') 
						or (@name = 'xmlDeregisterNodeDefaultValue')">
					<xsl:text>#ifdef LIBXML_THREAD_ENABLED&nl;</xsl:text>
					<xsl:if test="@name = 'docbDefaultSAXHandler'">
						<xsl:text>#ifdef LIBXML_DOCB_ENABLED&nl;</xsl:text>
					</xsl:if>
					<xsl:if test="@name = 'htmlDefaultSAXHandler'">
						<xsl:text>#ifdef LIBXML_HTML_ENABLED&nl;</xsl:text>
					</xsl:if>
					<xsl:text>__</xsl:text>
					<xsl:value-of select="@name"/>
					<xsl:text>&nl;</xsl:text>
					<xsl:if test="@name = 'docbDefaultSAXHandler'">
						<xsl:text>#endif&nl;</xsl:text>
					</xsl:if>
					<xsl:if test="@name = 'htmlDefaultSAXHandler'">
						<xsl:text>#endif&nl;</xsl:text>
					</xsl:if>
					<xsl:text>#else&nl;</xsl:text>
					<xsl:if test="@name = 'docbDefaultSAXHandler'">
						<xsl:text>#ifdef LIBXML_DOCB_ENABLED&nl;</xsl:text>
					</xsl:if>
					<xsl:if test="@name = 'htmlDefaultSAXHandler'">
						<xsl:text>#ifdef LIBXML_HTML_ENABLED&nl;</xsl:text>
					</xsl:if>
					<xsl:value-of select="@name"/>
					<xsl:text> DATA&nl;</xsl:text>
					<xsl:if test="@name = 'docbDefaultSAXHandler'">
						<xsl:text>#endif&nl;</xsl:text>
					</xsl:if>
					<xsl:if test="@name = 'htmlDefaultSAXHandler'">
						<xsl:text>#endif&nl;</xsl:text>
					</xsl:if>
					<xsl:text>#endif&nl;</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="@name"/>
					<xsl:if test="self::variable">
						<xsl:text> DATA</xsl:text>
					</xsl:if>
					<xsl:text>&nl;</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
			<!-- Basic tests (close) -->
			<xsl:if test="@file = 'c14n'">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@file = 'catalog'">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@file = 'debugXML'">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@file = 'DOCBparser'">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="(@file = 'HTMLparser') 
					or (@file = 'HTMLtree')">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@file = 'nanohttp'">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@file = 'nanoftp'">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="(@file = 'relaxng') 
					or (@file = 'xmlschemas') 
					or (@file = 'xmlschemastypes')">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@file = 'xinclude'">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@file = 'xlink'">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@file = 'xmlautomata'">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="(@file = 'xmlregexp') 
					or (@file = 'xmlunicode')">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="(@file = 'xpath') 
					or (@file = 'xpathInternals')">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@file = 'xpointer'">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<!-- Extended tests (close) -->
			<xsl:if test="(@name = 'htmlDefaultSAXHandlerInit') 
					or (@name = 'htmlInitAutoClose') 
					or (@name = 'htmlCreateFileParserCtxt') 
					or (@name = 'inithtmlDefaultSAXHandler')
					or (@name = 'xmlIsXHTML') 
					or (@name = 'xmlIOHTTPOpenW') 
					or (@name = 'xmlRegisterHTTPPostCallbacks') 
					or (@name = 'xmlIOHTTPMatch')
					or (@name = 'xmlIOHTTPOpen') 
					or (@name = 'xmlIOHTTPRead') 
					or (@name = 'xmlIOHTTPClose')">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="(@name = 'docbDefaultSAXHandlerInit') 
					or (@name = 'initdocbDefaultSAXHandler')">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="@name = 'xmlValidBuildContentModel'">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="(@name = 'xmlIOFTPMatch') 
					or (@name = 'xmlIOFTPOpen') 
					or (@name = 'xmlIOFTPRead') 
					or (@name = 'xmlIOFTPClose')">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="(@name = 'xmlTextReaderRelaxNGValidate') 
					or (@name = 'xmlTextReaderRelaxNGSetSchema')">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="(@name = 'xmlXPathDebugDumpObject') 
					or (@name = 'xmlXPathDebugDumpCompExpr')">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
			<xsl:if test="(@name = 'xmlMallocLoc') 
					or (@name = 'xmlMallocAtomicLoc') 
					or (@name = 'xmlReallocLoc') 
					or (@name = 'xmlMemStrdupLoc')">
				<xsl:text>#endif&nl;</xsl:text>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>
</xsl:stylesheet>