extensions.h 6.7 KB

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