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