1c2c66affSColin Finck /*
2c2c66affSColin Finck  * Summary: interface for the extension support
3c2c66affSColin Finck  * Description: This provide the API needed for simple and module
4c2c66affSColin Finck  *              extension support.
5c2c66affSColin Finck  *
6c2c66affSColin Finck  * Copy: See Copyright for the status of this software.
7c2c66affSColin Finck  *
8c2c66affSColin Finck  * Author: Daniel Veillard
9c2c66affSColin Finck  */
10c2c66affSColin Finck 
11c2c66affSColin Finck #ifndef __XML_XSLT_EXTENSION_H__
12c2c66affSColin Finck #define __XML_XSLT_EXTENSION_H__
13c2c66affSColin Finck 
14c2c66affSColin Finck #include <libxml/xpath.h>
15c2c66affSColin Finck #include "xsltexports.h"
16c2c66affSColin Finck #include "xsltInternals.h"
17c2c66affSColin Finck 
18c2c66affSColin Finck #ifdef __cplusplus
19c2c66affSColin Finck extern "C" {
20c2c66affSColin Finck #endif
21c2c66affSColin Finck 
22c2c66affSColin Finck /**
23c2c66affSColin Finck  * Extension Modules API.
24c2c66affSColin Finck  */
25c2c66affSColin Finck 
26c2c66affSColin Finck /**
27c2c66affSColin Finck  * xsltInitGlobals:
28c2c66affSColin Finck  *
29c2c66affSColin Finck  * Initialize the global variables for extensions
30c2c66affSColin Finck  *
31c2c66affSColin Finck  */
32c2c66affSColin Finck 
33c2c66affSColin Finck XSLTPUBFUN void XSLTCALL
34c2c66affSColin Finck 		xsltInitGlobals                 (void);
35c2c66affSColin Finck 
36c2c66affSColin Finck /**
37c2c66affSColin Finck  * xsltStyleExtInitFunction:
38c2c66affSColin Finck  * @ctxt:  an XSLT stylesheet
39c2c66affSColin Finck  * @URI:  the namespace URI for the extension
40c2c66affSColin Finck  *
41c2c66affSColin Finck  * A function called at initialization time of an XSLT extension module.
42c2c66affSColin Finck  *
43c2c66affSColin Finck  * Returns a pointer to the module specific data for this transformation.
44c2c66affSColin Finck  */
45c2c66affSColin Finck typedef void * (*xsltStyleExtInitFunction)	(xsltStylesheetPtr style,
46c2c66affSColin Finck 						 const xmlChar *URI);
47c2c66affSColin Finck 
48c2c66affSColin Finck /**
49c2c66affSColin Finck  * xsltStyleExtShutdownFunction:
50c2c66affSColin Finck  * @ctxt:  an XSLT stylesheet
51c2c66affSColin Finck  * @URI:  the namespace URI for the extension
52c2c66affSColin Finck  * @data:  the data associated to this module
53c2c66affSColin Finck  *
54c2c66affSColin Finck  * A function called at shutdown time of an XSLT extension module.
55c2c66affSColin Finck  */
56c2c66affSColin Finck typedef void (*xsltStyleExtShutdownFunction)	(xsltStylesheetPtr style,
57c2c66affSColin Finck 						 const xmlChar *URI,
58c2c66affSColin Finck 						 void *data);
59c2c66affSColin Finck 
60c2c66affSColin Finck /**
61c2c66affSColin Finck  * xsltExtInitFunction:
62c2c66affSColin Finck  * @ctxt:  an XSLT transformation context
63c2c66affSColin Finck  * @URI:  the namespace URI for the extension
64c2c66affSColin Finck  *
65c2c66affSColin Finck  * A function called at initialization time of an XSLT extension module.
66c2c66affSColin Finck  *
67c2c66affSColin Finck  * Returns a pointer to the module specific data for this transformation.
68c2c66affSColin Finck  */
69c2c66affSColin Finck typedef void * (*xsltExtInitFunction)	(xsltTransformContextPtr ctxt,
70c2c66affSColin Finck 					 const xmlChar *URI);
71c2c66affSColin Finck 
72c2c66affSColin Finck /**
73c2c66affSColin Finck  * xsltExtShutdownFunction:
74c2c66affSColin Finck  * @ctxt:  an XSLT transformation context
75c2c66affSColin Finck  * @URI:  the namespace URI for the extension
76c2c66affSColin Finck  * @data:  the data associated to this module
77c2c66affSColin Finck  *
78c2c66affSColin Finck  * A function called at shutdown time of an XSLT extension module.
79c2c66affSColin Finck  */
80c2c66affSColin Finck typedef void (*xsltExtShutdownFunction) (xsltTransformContextPtr ctxt,
81c2c66affSColin Finck 					 const xmlChar *URI,
82c2c66affSColin Finck 					 void *data);
83c2c66affSColin Finck 
84c2c66affSColin Finck XSLTPUBFUN int XSLTCALL
85c2c66affSColin Finck 		xsltRegisterExtModule	(const xmlChar *URI,
86c2c66affSColin Finck 					 xsltExtInitFunction initFunc,
87c2c66affSColin Finck 					 xsltExtShutdownFunction shutdownFunc);
88c2c66affSColin Finck XSLTPUBFUN int XSLTCALL
89c2c66affSColin Finck 		xsltRegisterExtModuleFull
90c2c66affSColin Finck 					(const xmlChar * URI,
91c2c66affSColin Finck 					 xsltExtInitFunction initFunc,
92c2c66affSColin Finck 					 xsltExtShutdownFunction shutdownFunc,
93c2c66affSColin Finck 					 xsltStyleExtInitFunction styleInitFunc,
94c2c66affSColin Finck 					 xsltStyleExtShutdownFunction styleShutdownFunc);
95c2c66affSColin Finck 
96c2c66affSColin Finck XSLTPUBFUN int XSLTCALL
97c2c66affSColin Finck 		xsltUnregisterExtModule	(const xmlChar * URI);
98c2c66affSColin Finck 
99c2c66affSColin Finck XSLTPUBFUN void * XSLTCALL
100c2c66affSColin Finck 		xsltGetExtData		(xsltTransformContextPtr ctxt,
101c2c66affSColin Finck 					 const xmlChar *URI);
102c2c66affSColin Finck 
103c2c66affSColin Finck XSLTPUBFUN void * XSLTCALL
104c2c66affSColin Finck 		xsltStyleGetExtData	(xsltStylesheetPtr style,
105c2c66affSColin Finck 					 const xmlChar *URI);
106c2c66affSColin Finck #ifdef XSLT_REFACTORED
107c2c66affSColin Finck XSLTPUBFUN void * XSLTCALL
108c2c66affSColin Finck 		xsltStyleStylesheetLevelGetExtData(
109c2c66affSColin Finck 					 xsltStylesheetPtr style,
110c2c66affSColin Finck 					 const xmlChar * URI);
111c2c66affSColin Finck #endif
112c2c66affSColin Finck XSLTPUBFUN void XSLTCALL
113c2c66affSColin Finck 		xsltShutdownCtxtExts	(xsltTransformContextPtr ctxt);
114c2c66affSColin Finck 
115c2c66affSColin Finck XSLTPUBFUN void XSLTCALL
116c2c66affSColin Finck 		xsltShutdownExts	(xsltStylesheetPtr style);
117c2c66affSColin Finck 
118c2c66affSColin Finck XSLTPUBFUN xsltTransformContextPtr XSLTCALL
119c2c66affSColin Finck 		xsltXPathGetTransformContext
120c2c66affSColin Finck 					(xmlXPathParserContextPtr ctxt);
121c2c66affSColin Finck 
122c2c66affSColin Finck /*
123c2c66affSColin Finck  * extension functions
124c2c66affSColin Finck */
125c2c66affSColin Finck XSLTPUBFUN int XSLTCALL
126c2c66affSColin Finck 		xsltRegisterExtModuleFunction
127c2c66affSColin Finck 					(const xmlChar *name,
128c2c66affSColin Finck 					 const xmlChar *URI,
129c2c66affSColin Finck 					 xmlXPathFunction function);
130c2c66affSColin Finck XSLTPUBFUN xmlXPathFunction XSLTCALL
131c2c66affSColin Finck 	xsltExtModuleFunctionLookup	(const xmlChar *name,
132c2c66affSColin Finck 					 const xmlChar *URI);
133c2c66affSColin Finck XSLTPUBFUN int XSLTCALL
134c2c66affSColin Finck 		xsltUnregisterExtModuleFunction
135c2c66affSColin Finck 					(const xmlChar *name,
136c2c66affSColin Finck 					 const xmlChar *URI);
137c2c66affSColin Finck 
138c2c66affSColin Finck /*
139c2c66affSColin Finck  * extension elements
140c2c66affSColin Finck  */
141c2c66affSColin Finck typedef xsltElemPreCompPtr (*xsltPreComputeFunction)
142c2c66affSColin Finck 					(xsltStylesheetPtr style,
143c2c66affSColin Finck 					 xmlNodePtr inst,
144c2c66affSColin Finck 					 xsltTransformFunction function);
145c2c66affSColin Finck 
146c2c66affSColin Finck XSLTPUBFUN xsltElemPreCompPtr XSLTCALL
147c2c66affSColin Finck 		xsltNewElemPreComp	(xsltStylesheetPtr style,
148c2c66affSColin Finck 					 xmlNodePtr inst,
149c2c66affSColin Finck 					 xsltTransformFunction function);
150c2c66affSColin Finck XSLTPUBFUN void XSLTCALL
151c2c66affSColin Finck 		xsltInitElemPreComp	(xsltElemPreCompPtr comp,
152c2c66affSColin Finck 					 xsltStylesheetPtr style,
153c2c66affSColin Finck 					 xmlNodePtr inst,
154c2c66affSColin Finck 					 xsltTransformFunction function,
155c2c66affSColin Finck 					 xsltElemPreCompDeallocator freeFunc);
156c2c66affSColin Finck 
157c2c66affSColin Finck XSLTPUBFUN int XSLTCALL
158c2c66affSColin Finck 		xsltRegisterExtModuleElement
159c2c66affSColin Finck 					(const xmlChar *name,
160c2c66affSColin Finck 					 const xmlChar *URI,
161c2c66affSColin Finck 					 xsltPreComputeFunction precomp,
162c2c66affSColin Finck 					 xsltTransformFunction transform);
163c2c66affSColin Finck XSLTPUBFUN xsltTransformFunction XSLTCALL
164c2c66affSColin Finck 		xsltExtElementLookup	(xsltTransformContextPtr ctxt,
165c2c66affSColin Finck 					 const xmlChar *name,
166c2c66affSColin Finck 					 const xmlChar *URI);
167c2c66affSColin Finck XSLTPUBFUN xsltTransformFunction XSLTCALL
168c2c66affSColin Finck 		xsltExtModuleElementLookup
169c2c66affSColin Finck 					(const xmlChar *name,
170c2c66affSColin Finck 					 const xmlChar *URI);
171c2c66affSColin Finck XSLTPUBFUN xsltPreComputeFunction XSLTCALL
172c2c66affSColin Finck 		xsltExtModuleElementPreComputeLookup
173c2c66affSColin Finck 					(const xmlChar *name,
174c2c66affSColin Finck 					 const xmlChar *URI);
175c2c66affSColin Finck XSLTPUBFUN int XSLTCALL
176c2c66affSColin Finck 		xsltUnregisterExtModuleElement
177c2c66affSColin Finck 					(const xmlChar *name,
178c2c66affSColin Finck 					 const xmlChar *URI);
179c2c66affSColin Finck 
180c2c66affSColin Finck /*
181c2c66affSColin Finck  * top-level elements
182c2c66affSColin Finck  */
183c2c66affSColin Finck typedef void (*xsltTopLevelFunction)	(xsltStylesheetPtr style,
184c2c66affSColin Finck 					 xmlNodePtr inst);
185c2c66affSColin Finck 
186c2c66affSColin Finck XSLTPUBFUN int XSLTCALL
187c2c66affSColin Finck 		xsltRegisterExtModuleTopLevel
188c2c66affSColin Finck 					(const xmlChar *name,
189c2c66affSColin Finck 					 const xmlChar *URI,
190c2c66affSColin Finck 					 xsltTopLevelFunction function);
191c2c66affSColin Finck XSLTPUBFUN xsltTopLevelFunction XSLTCALL
192c2c66affSColin Finck 		xsltExtModuleTopLevelLookup
193c2c66affSColin Finck 					(const xmlChar *name,
194c2c66affSColin Finck 					 const xmlChar *URI);
195c2c66affSColin Finck XSLTPUBFUN int XSLTCALL
196c2c66affSColin Finck 		xsltUnregisterExtModuleTopLevel
197c2c66affSColin Finck 					(const xmlChar *name,
198c2c66affSColin Finck 					 const xmlChar *URI);
199c2c66affSColin Finck 
200c2c66affSColin Finck 
201c2c66affSColin Finck /* These 2 functions are deprecated for use within modules. */
202c2c66affSColin Finck XSLTPUBFUN int XSLTCALL
203c2c66affSColin Finck 		xsltRegisterExtFunction	(xsltTransformContextPtr ctxt,
204c2c66affSColin Finck 					 const xmlChar *name,
205c2c66affSColin Finck 					 const xmlChar *URI,
206c2c66affSColin Finck 					 xmlXPathFunction function);
207c2c66affSColin Finck XSLTPUBFUN int XSLTCALL
208c2c66affSColin Finck 		xsltRegisterExtElement	(xsltTransformContextPtr ctxt,
209c2c66affSColin Finck 					 const xmlChar *name,
210c2c66affSColin Finck 					 const xmlChar *URI,
211c2c66affSColin Finck 					 xsltTransformFunction function);
212c2c66affSColin Finck 
213c2c66affSColin Finck /*
214c2c66affSColin Finck  * Extension Prefix handling API.
215c2c66affSColin Finck  * Those are used by the XSLT (pre)processor.
216c2c66affSColin Finck  */
217c2c66affSColin Finck 
218c2c66affSColin Finck XSLTPUBFUN int XSLTCALL
219c2c66affSColin Finck 		xsltRegisterExtPrefix	(xsltStylesheetPtr style,
220c2c66affSColin Finck 					 const xmlChar *prefix,
221c2c66affSColin Finck 					 const xmlChar *URI);
222c2c66affSColin Finck XSLTPUBFUN int XSLTCALL
223c2c66affSColin Finck 		xsltCheckExtPrefix	(xsltStylesheetPtr style,
224c2c66affSColin Finck 					 const xmlChar *URI);
225c2c66affSColin Finck XSLTPUBFUN int XSLTCALL
226c2c66affSColin Finck 		xsltCheckExtURI		(xsltStylesheetPtr style,
227c2c66affSColin Finck 					 const xmlChar *URI);
228c2c66affSColin Finck XSLTPUBFUN int XSLTCALL
229c2c66affSColin Finck 		xsltInitCtxtExts	(xsltTransformContextPtr ctxt);
230c2c66affSColin Finck XSLTPUBFUN void XSLTCALL
231c2c66affSColin Finck 		xsltFreeCtxtExts	(xsltTransformContextPtr ctxt);
232c2c66affSColin Finck XSLTPUBFUN void XSLTCALL
233c2c66affSColin Finck 		xsltFreeExts		(xsltStylesheetPtr style);
234c2c66affSColin Finck 
235c2c66affSColin Finck XSLTPUBFUN xsltElemPreCompPtr XSLTCALL
236c2c66affSColin Finck 		xsltPreComputeExtModuleElement
237c2c66affSColin Finck 					(xsltStylesheetPtr style,
238c2c66affSColin Finck 					 xmlNodePtr inst);
239c2c66affSColin Finck /*
240c2c66affSColin Finck  * Extension Infos access.
241c2c66affSColin Finck  * Used by exslt initialisation
242c2c66affSColin Finck  */
243c2c66affSColin Finck 
244c2c66affSColin Finck XSLTPUBFUN xmlHashTablePtr XSLTCALL
245c2c66affSColin Finck 		xsltGetExtInfo		(xsltStylesheetPtr style,
246c2c66affSColin Finck 					 const xmlChar *URI);
247c2c66affSColin Finck 
248c2c66affSColin Finck /**
249*f7671c1bSThomas Faber  * Test of the extension module API
250c2c66affSColin Finck  */
251c2c66affSColin Finck XSLTPUBFUN void XSLTCALL
252c2c66affSColin Finck 		xsltRegisterTestModule	(void);
253c2c66affSColin Finck XSLTPUBFUN void XSLTCALL
254c2c66affSColin Finck 		xsltDebugDumpExtensions	(FILE * output);
255c2c66affSColin Finck 
256c2c66affSColin Finck 
257c2c66affSColin Finck #ifdef __cplusplus
258c2c66affSColin Finck }
259c2c66affSColin Finck #endif
260c2c66affSColin Finck 
261c2c66affSColin Finck #endif /* __XML_XSLT_EXTENSION_H__ */
262c2c66affSColin Finck 
263