ReactOS 0.4.15-dev-8100-g1887773
extensions.c
Go to the documentation of this file.
1/*
2 * extensions.c: Implemetation of the extensions support
3 *
4 * Reference:
5 * http://www.w3.org/TR/1999/REC-xslt-19991116
6 *
7 * See Copyright for the status of this software.
8 *
9 * daniel@veillard.com
10 */
11
12#include "precomp.h"
13
14#ifdef WITH_MODULES
15#include <libxml/xmlmodule.h>
16#endif
17#include <libxml/list.h>
18
19#ifdef _WIN32
20#ifndef PATH_MAX
21#define PATH_MAX _MAX_PATH
22#endif
23#endif
24
25#ifdef WITH_XSLT_DEBUG
26#define WITH_XSLT_DEBUG_EXTENSIONS
27#endif
28
29/************************************************************************
30 * *
31 * Private Types and Globals *
32 * *
33 ************************************************************************/
34
35typedef struct _xsltExtDef xsltExtDef;
41 void *data;
42};
43
51};
52
57 void *extData;
58};
59
65};
66
73
74/************************************************************************
75 * *
76 * Type functions *
77 * *
78 ************************************************************************/
79
89static xsltExtDefPtr
90xsltNewExtDef(const xmlChar * prefix, const xmlChar * URI)
91{
93
95 if (cur == NULL) {
97 "xsltNewExtDef : malloc failed\n");
98 return (NULL);
99 }
100 memset(cur, 0, sizeof(xsltExtDef));
101 if (prefix != NULL)
102 cur->prefix = xmlStrdup(prefix);
103 if (URI != NULL)
104 cur->URI = xmlStrdup(URI);
105 return (cur);
106}
107
114static void
116{
117 if (extensiond == NULL)
118 return;
119 if (extensiond->prefix != NULL)
120 xmlFree(extensiond->prefix);
121 if (extensiond->URI != NULL)
122 xmlFree(extensiond->URI);
123 xmlFree(extensiond);
124}
125
132static void
134{
136
137 while (extensiond != NULL) {
138 cur = extensiond;
139 extensiond = extensiond->next;
141 }
142}
143
155static xsltExtModulePtr
157 xsltExtShutdownFunction shutdownFunc,
158 xsltStyleExtInitFunction styleInitFunc,
159 xsltStyleExtShutdownFunction styleShutdownFunc)
160{
162
164 if (cur == NULL) {
166 "xsltNewExtModule : malloc failed\n");
167 return (NULL);
168 }
169 cur->initFunc = initFunc;
170 cur->shutdownFunc = shutdownFunc;
171 cur->styleInitFunc = styleInitFunc;
172 cur->styleShutdownFunc = styleShutdownFunc;
173 return (cur);
174}
175
182static void
184{
185 if (ext == NULL)
186 return;
187 xmlFree(ext);
188}
189
190static void
193}
194
204static xsltExtDataPtr
205xsltNewExtData(xsltExtModulePtr extModule, void *extData)
206{
208
209 if (extModule == NULL)
210 return (NULL);
212 if (cur == NULL) {
214 "xsltNewExtData : malloc failed\n");
215 return (NULL);
216 }
217 cur->extModule = extModule;
218 cur->extData = extData;
219 return (cur);
220}
221
228static void
230{
231 if (ext == NULL)
232 return;
233 xmlFree(ext);
234}
235
236static void
239}
240
254{
256
257 if (transform == NULL)
258 return (NULL);
259
261 if (cur == NULL) {
263 "xsltNewExtElement : malloc failed\n");
264 return (NULL);
265 }
266 cur->precomp = precomp;
267 cur->transform = transform;
268 return (cur);
269}
270
277static void
279{
280 if (ext == NULL)
281 return;
282 xmlFree(ext);
283}
284
285static void
288}
289
290
291#ifdef WITH_MODULES
292typedef void (*exsltRegisterFunction) (void);
293
294#ifndef PATH_MAX
295#define PATH_MAX 4096
296#endif
297
317static int
319{
320
321 xmlModulePtr m;
322 exsltRegisterFunction regfunc;
323 xmlChar *ext_name;
324 char module_filename[PATH_MAX];
325 const xmlChar *ext_directory = NULL;
326 const xmlChar *protocol = NULL;
327 xmlChar *i, *regfunc_name;
328 void *vregfunc;
329 int rc;
330
331 /* check for bad inputs */
332 if (URI == NULL)
333 return (-1);
334
335 if (NULL == xsltModuleHash) {
337 if (xsltModuleHash == NULL)
338 return (-1);
339 }
340
342
343 /* have we attempted to register this module already? */
344 if (xmlHashLookup(xsltModuleHash, URI) != NULL) {
346 return (-1);
347 }
349
350 /* transform extension namespace into a module name */
351 protocol = xmlStrstr(URI, BAD_CAST "://");
352 if (protocol == NULL) {
353 ext_name = xmlStrdup(URI);
354 } else {
355 ext_name = xmlStrdup(protocol + 3);
356 }
357 if (ext_name == NULL) {
358 return (-1);
359 }
360
361 i = ext_name;
362 while ('\0' != *i) {
363 if (('/' == *i) || ('\\' == *i) || ('.' == *i) || ('-' == *i))
364 *i = '_';
365 i++;
366 }
367
368 /* Strip underscores from end of string. */
369 while (i > ext_name && *(i - 1) == '_') {
370 i--;
371 *i = '\0';
372 }
373
374 /* determine module directory */
375 ext_directory = (xmlChar *) getenv("LIBXSLT_PLUGINS_PATH");
376
377 if (NULL == ext_directory) {
378 ext_directory = BAD_CAST LIBXSLT_DEFAULT_PLUGINS_PATH();
379 if (NULL == ext_directory)
380 return (-1);
381 }
382#ifdef WITH_XSLT_DEBUG_EXTENSIONS
383 else
385 "LIBXSLT_PLUGINS_PATH is %s\n", ext_directory);
386#endif
387
388 /* build the module filename, and confirm the module exists */
389 xmlStrPrintf((xmlChar *) module_filename, sizeof(module_filename),
390 "%s/%s%s", ext_directory, ext_name, LIBXML_MODULE_EXTENSION);
391
392#ifdef WITH_XSLT_DEBUG_EXTENSIONS
394 "Attempting to load plugin: %s for URI: %s\n",
395 module_filename, URI);
396#endif
397
398 if (1 != xmlCheckFilename(module_filename)) {
399
400#ifdef WITH_XSLT_DEBUG_EXTENSIONS
402 "xmlCheckFilename failed for plugin: %s\n", module_filename);
403#endif
404
405 xmlFree(ext_name);
406 return (-1);
407 }
408
409 /* attempt to open the module */
410 m = xmlModuleOpen(module_filename, 0);
411 if (NULL == m) {
412
413#ifdef WITH_XSLT_DEBUG_EXTENSIONS
415 "xmlModuleOpen failed for plugin: %s\n", module_filename);
416#endif
417
418 xmlFree(ext_name);
419 return (-1);
420 }
421
422 /* construct initialization func name */
423 regfunc_name = xmlStrdup(ext_name);
424 regfunc_name = xmlStrcat(regfunc_name, BAD_CAST "_init");
425
426 vregfunc = NULL;
427 rc = xmlModuleSymbol(m, (const char *) regfunc_name, &vregfunc);
428 regfunc = vregfunc;
429 if (0 == rc) {
430 /*
431 * Call the module's init function. Note that this function
432 * calls xsltRegisterExtModuleFull which will add the module
433 * to xsltExtensionsHash (together with it's entry points).
434 */
435 (*regfunc) ();
436
437 /* register this module in our hash */
439 xmlHashAddEntry(xsltModuleHash, URI, (void *) m);
441 } else {
442
443#ifdef WITH_XSLT_DEBUG_EXTENSIONS
445 "xmlModuleSymbol failed for plugin: %s, regfunc: %s\n",
446 module_filename, regfunc_name);
447#endif
448
449 /* if regfunc not found unload the module immediately */
450 xmlModuleClose(m);
451 }
452
453 xmlFree(ext_name);
454 xmlFree(regfunc_name);
455 return (NULL == regfunc) ? -1 : 0;
456}
457#else
458static int
460{
461 return -1;
462}
463#endif
464
465/************************************************************************
466 * *
467 * The stylesheet extension prefixes handling *
468 * *
469 ************************************************************************/
470
471
478void
480{
481 if (style->nsDefs != NULL)
483}
484
502int
504 const xmlChar * prefix, const xmlChar * URI)
505{
506 xsltExtDefPtr def, ret;
507
508 if ((style == NULL) || (URI == NULL))
509 return (-1);
510
511#ifdef WITH_XSLT_DEBUG_EXTENSIONS
513 "Registering extension namespace '%s'.\n", URI);
514#endif
515 def = (xsltExtDefPtr) style->nsDefs;
516#ifdef XSLT_REFACTORED
517 /*
518 * The extension is associated with a namespace name.
519 */
520 while (def != NULL) {
521 if (xmlStrEqual(URI, def->URI))
522 return (1);
523 def = def->next;
524 }
525#else
526 while (def != NULL) {
527 if (xmlStrEqual(prefix, def->prefix))
528 return (-1);
529 def = def->next;
530 }
531#endif
532 ret = xsltNewExtDef(prefix, URI);
533 if (ret == NULL)
534 return (-1);
535 ret->next = (xsltExtDefPtr) style->nsDefs;
536 style->nsDefs = ret;
537
538 /*
539 * check whether there is an extension module with a stylesheet
540 * initialization function.
541 */
542#ifdef XSLT_REFACTORED
543 /*
544 * Don't initialize modules based on specified namespaces via
545 * the attribute "[xsl:]extension-element-prefixes".
546 */
547#else
550
554 if (NULL == module) {
559 }
560 }
561 if (module != NULL) {
563 }
564 }
565#endif
566 return (0);
567}
568
569/************************************************************************
570 * *
571 * The extensions modules interfaces *
572 * *
573 ************************************************************************/
574
586int
588 const xmlChar * URI, xmlXPathFunction function)
589{
590 int ret;
591
592 if ((ctxt == NULL) || (name == NULL) ||
593 (URI == NULL) || (function == NULL))
594 return (-1);
595 if (ctxt->xpathCtxt != NULL) {
596 xmlXPathRegisterFuncNS(ctxt->xpathCtxt, name, URI, function);
597 }
598 if (ctxt->extFunctions == NULL)
599 ctxt->extFunctions = xmlHashCreate(10);
600 if (ctxt->extFunctions == NULL)
601 return (-1);
602
604 XML_CAST_FPTR(function));
605
606 return(ret);
607}
608
620int
622 const xmlChar * URI, xsltTransformFunction function)
623{
624 if ((ctxt == NULL) || (name == NULL) ||
625 (URI == NULL) || (function == NULL))
626 return (-1);
627 if (ctxt->extElements == NULL)
628 ctxt->extElements = xmlHashCreate(10);
629 if (ctxt->extElements == NULL)
630 return (-1);
631 return (xmlHashAddEntry2
632 (ctxt->extElements, name, URI, XML_CAST_FPTR(function)));
633}
634
641void
643{
644 if (ctxt->extElements != NULL)
646 if (ctxt->extFunctions != NULL)
648}
649
662static xsltExtDataPtr
664 const xmlChar * URI)
665{
666 xsltExtDataPtr dataContainer;
667 void *userData = NULL;
669
670 if ((style == NULL) || (URI == NULL))
671 return(NULL);
672
673 if (xsltExtensionsHash == NULL) {
674#ifdef WITH_XSLT_DEBUG_EXTENSIONS
676 "Not registered extension module: %s\n", URI);
677#endif
678 return(NULL);
679 }
680
682
684
686
687 if (module == NULL) {
688#ifdef WITH_XSLT_DEBUG_EXTENSIONS
690 "Not registered extension module: %s\n", URI);
691#endif
692 return (NULL);
693 }
694 /*
695 * The specified module was registered so initialize it.
696 */
697 if (style->extInfos == NULL) {
698 style->extInfos = xmlHashCreate(10);
699 if (style->extInfos == NULL)
700 return (NULL);
701 }
702 /*
703 * Fire the initialization callback if available.
704 */
705 if (module->styleInitFunc == NULL) {
706#ifdef WITH_XSLT_DEBUG_EXTENSIONS
708 "Initializing module with *no* callback: %s\n", URI);
709#endif
710 } else {
711#ifdef WITH_XSLT_DEBUG_EXTENSIONS
713 "Initializing module with callback: %s\n", URI);
714#endif
715 /*
716 * Fire the initialization callback.
717 */
718 userData = module->styleInitFunc(style, URI);
719 }
720 /*
721 * Store the user-data in the context of the given stylesheet.
722 */
723 dataContainer = xsltNewExtData(module, userData);
724 if (dataContainer == NULL)
725 return (NULL);
726
727 if (xmlHashAddEntry(style->extInfos, URI,
728 (void *) dataContainer) < 0)
729 {
731 "Failed to register module '%s'.\n", URI);
732 style->errors++;
733 if (module->styleShutdownFunc)
734 module->styleShutdownFunc(style, URI, userData);
735 xsltFreeExtData(dataContainer);
736 return (NULL);
737 }
738
739 return(dataContainer);
740}
741
755void *
757{
758 xsltExtDataPtr dataContainer = NULL;
759 xsltStylesheetPtr tmpStyle;
760
761 if ((style == NULL) || (URI == NULL) ||
763 return (NULL);
764
765
766#ifdef XSLT_REFACTORED
767 /*
768 * This is intended for global storage, so only the main
769 * stylesheet will hold the data.
770 */
771 tmpStyle = style;
772 while (tmpStyle->parent != NULL)
773 tmpStyle = tmpStyle->parent;
774 if (tmpStyle->extInfos != NULL) {
775 dataContainer =
776 (xsltExtDataPtr) xmlHashLookup(tmpStyle->extInfos, URI);
777 if (dataContainer != NULL) {
778 /*
779 * The module was already initialized in the context
780 * of this stylesheet; just return the user-data that
781 * comes with it.
782 */
783 return(dataContainer->extData);
784 }
785 }
786#else
787 /*
788 * Old behaviour.
789 */
790 tmpStyle = style;
791 while (tmpStyle != NULL) {
792 if (tmpStyle->extInfos != NULL) {
793 dataContainer =
794 (xsltExtDataPtr) xmlHashLookup(tmpStyle->extInfos, URI);
795 if (dataContainer != NULL) {
796 return(dataContainer->extData);
797 }
798 }
799 tmpStyle = xsltNextImport(tmpStyle);
800 }
801 tmpStyle = style;
802#endif
803
804 dataContainer =
806 if (dataContainer != NULL)
807 return (dataContainer->extData);
808 return(NULL);
809}
810
811#ifdef XSLT_REFACTORED
822void *
823xsltStyleStylesheetLevelGetExtData(xsltStylesheetPtr style,
824 const xmlChar * URI)
825{
826 xsltExtDataPtr dataContainer = NULL;
827
828 if ((style == NULL) || (URI == NULL) ||
830 return (NULL);
831
832 if (style->extInfos != NULL) {
833 dataContainer = (xsltExtDataPtr) xmlHashLookup(style->extInfos, URI);
834 /*
835 * The module was already initialized in the context
836 * of this stylesheet; just return the user-data that
837 * comes with it.
838 */
839 if (dataContainer)
840 return(dataContainer->extData);
841 }
842
843 dataContainer =
845 if (dataContainer != NULL)
846 return (dataContainer->extData);
847 return(NULL);
848}
849#endif
850
861void *
863{
865
866 if ((ctxt == NULL) || (URI == NULL))
867 return (NULL);
868 if (ctxt->extInfos == NULL) {
869 ctxt->extInfos = xmlHashCreate(10);
870 if (ctxt->extInfos == NULL)
871 return (NULL);
872 data = NULL;
873 } else {
875 }
876 if (data == NULL) {
877 void *extData;
879
881
883
885
886 if (module == NULL) {
887#ifdef WITH_XSLT_DEBUG_EXTENSIONS
889 "Not registered extension module: %s\n", URI);
890#endif
891 return (NULL);
892 } else {
893 if (module->initFunc == NULL)
894 return (NULL);
895
896#ifdef WITH_XSLT_DEBUG_EXTENSIONS
898 "Initializing module: %s\n", URI);
899#endif
900
901 extData = module->initFunc(ctxt, URI);
902 if (extData == NULL)
903 return (NULL);
904
905 data = xsltNewExtData(module, extData);
906 if (data == NULL)
907 return (NULL);
908 if (xmlHashAddEntry(ctxt->extInfos, URI, (void *) data) < 0) {
910 "Failed to register module data: %s\n",
911 URI);
912 if (module->shutdownFunc)
913 module->shutdownFunc(ctxt, URI, extData);
915 return (NULL);
916 }
917 }
918 }
919 return (data->extData);
920}
921
925 int ret;
926};
927
936static void
937xsltInitCtxtExt(void *payload, void *data, const xmlChar * URI)
938{
939 xsltExtDataPtr styleData = (xsltExtDataPtr) payload;
942 xsltExtDataPtr ctxtData;
943 void *extData;
944
945 if ((styleData == NULL) || (ctxt == NULL) || (URI == NULL) ||
946 (ctxt->ret == -1)) {
947#ifdef WITH_XSLT_DEBUG_EXTENSIONS
949 "xsltInitCtxtExt: NULL param or error\n");
950#endif
951 return;
952 }
953 module = styleData->extModule;
954 if ((module == NULL) || (module->initFunc == NULL)) {
955#ifdef WITH_XSLT_DEBUG_EXTENSIONS
957 "xsltInitCtxtExt: no module or no initFunc\n");
958#endif
959 return;
960 }
961
962 ctxtData = (xsltExtDataPtr) xmlHashLookup(ctxt->ctxt->extInfos, URI);
963 if (ctxtData != NULL) {
964#ifdef WITH_XSLT_DEBUG_EXTENSIONS
966 "xsltInitCtxtExt: already initialized\n");
967#endif
968 return;
969 }
970
971 extData = module->initFunc(ctxt->ctxt, URI);
972 if (extData == NULL) {
973#ifdef WITH_XSLT_DEBUG_EXTENSIONS
975 "xsltInitCtxtExt: no extData\n");
976#endif
977 }
978 ctxtData = xsltNewExtData(module, extData);
979 if (ctxtData == NULL) {
980 ctxt->ret = -1;
981 return;
982 }
983
984 if (ctxt->ctxt->extInfos == NULL)
985 ctxt->ctxt->extInfos = xmlHashCreate(10);
986 if (ctxt->ctxt->extInfos == NULL) {
987 ctxt->ret = -1;
988 return;
989 }
990
991 if (xmlHashAddEntry(ctxt->ctxt->extInfos, URI, ctxtData) < 0) {
993 "Failed to register module data: %s\n", URI);
994 if (module->shutdownFunc)
995 module->shutdownFunc(ctxt->ctxt, URI, extData);
996 xsltFreeExtData(ctxtData);
997 ctxt->ret = -1;
998 return;
999 }
1000#ifdef WITH_XSLT_DEBUG_EXTENSIONS
1001 xsltGenericDebug(xsltGenericDebugContext, "Registered module %s\n",
1002 URI);
1003#endif
1004 ctxt->ret++;
1005}
1006
1015int
1017{
1020
1021 if (ctxt == NULL)
1022 return (-1);
1023
1024 style = ctxt->style;
1025 if (style == NULL)
1026 return (-1);
1027
1028 ctx.ctxt = ctxt;
1029 ctx.ret = 0;
1030
1031 while (style != NULL) {
1032 if (style->extInfos != NULL) {
1033 xmlHashScan(style->extInfos, xsltInitCtxtExt, &ctx);
1034 if (ctx.ret == -1)
1035 return (-1);
1036 }
1038 }
1039#ifdef WITH_XSLT_DEBUG_EXTENSIONS
1040 xsltGenericDebug(xsltGenericDebugContext, "Registered %d modules\n",
1041 ctx.ret);
1042#endif
1043 return (ctx.ret);
1044}
1045
1054static void
1055xsltShutdownCtxtExt(void *payload, void *vctxt, const xmlChar * URI)
1056{
1060
1061 if ((data == NULL) || (ctxt == NULL) || (URI == NULL))
1062 return;
1063 module = data->extModule;
1064 if ((module == NULL) || (module->shutdownFunc == NULL))
1065 return;
1066
1067#ifdef WITH_XSLT_DEBUG_EXTENSIONS
1069 "Shutting down module : %s\n", URI);
1070#endif
1071 module->shutdownFunc(ctxt, URI, data->extData);
1072}
1073
1080void
1082{
1083 if (ctxt == NULL)
1084 return;
1085 if (ctxt->extInfos == NULL)
1086 return;
1089 ctxt->extInfos = NULL;
1090}
1091
1100static void
1101xsltShutdownExt(void *payload, void *vctxt, const xmlChar * URI)
1102{
1106
1107 if ((data == NULL) || (style == NULL) || (URI == NULL))
1108 return;
1109 module = data->extModule;
1110 if ((module == NULL) || (module->styleShutdownFunc == NULL))
1111 return;
1112
1113#ifdef WITH_XSLT_DEBUG_EXTENSIONS
1115 "Shutting down module : %s\n", URI);
1116#endif
1117 module->styleShutdownFunc(style, URI, data->extData);
1118 /*
1119 * Don't remove the entry from the hash table here, since
1120 * this will produce segfaults - this fixes bug #340624.
1121 *
1122 * xmlHashRemoveEntry(style->extInfos, URI, xsltFreeExtDataEntry);
1123 */
1124}
1125
1132void
1134{
1135 if (style == NULL)
1136 return;
1137 if (style->extInfos == NULL)
1138 return;
1141 style->extInfos = NULL;
1142}
1143
1157int
1159{
1160#ifdef XSLT_REFACTORED
1161 if ((style == NULL) || (style->compCtxt == NULL) ||
1162 (XSLT_CCTXT(style)->inode == NULL) ||
1163 (XSLT_CCTXT(style)->inode->extElemNs == NULL))
1164 return (0);
1165 /*
1166 * Lookup the extension namespaces registered
1167 * at the current node in the stylesheet's tree.
1168 */
1169 if (XSLT_CCTXT(style)->inode->extElemNs != NULL) {
1170 int i;
1171 xsltPointerListPtr list = XSLT_CCTXT(style)->inode->extElemNs;
1172
1173 for (i = 0; i < list->number; i++) {
1174 if (xmlStrEqual((const xmlChar *) list->items[i],
1175 URI))
1176 {
1177 return(1);
1178 }
1179 }
1180 }
1181#else
1183
1184 if ((style == NULL) || (style->nsDefs == NULL))
1185 return (0);
1186 if (URI == NULL)
1187 URI = BAD_CAST "#default";
1188 cur = (xsltExtDefPtr) style->nsDefs;
1189 while (cur != NULL) {
1190 /*
1191 * NOTE: This was change to work on namespace names rather
1192 * than namespace prefixes. This fixes bug #339583.
1193 * TODO: Consider renaming the field "prefix" of xsltExtDef
1194 * to "href".
1195 */
1196 if (xmlStrEqual(URI, cur->prefix))
1197 return (1);
1198 cur = cur->next;
1199 }
1200#endif
1201 return (0);
1202}
1203
1217int
1219{
1221
1222 if ((style == NULL) || (style->nsDefs == NULL))
1223 return (0);
1224 if (URI == NULL)
1225 return (0);
1226 cur = (xsltExtDefPtr) style->nsDefs;
1227 while (cur != NULL) {
1228 if (xmlStrEqual(URI, cur->URI))
1229 return (1);
1230 cur = cur->next;
1231 }
1232 return (0);
1233}
1234
1247int
1249 xsltExtInitFunction initFunc,
1250 xsltExtShutdownFunction shutdownFunc,
1251 xsltStyleExtInitFunction styleInitFunc,
1252 xsltStyleExtShutdownFunction styleShutdownFunc)
1253{
1254 int ret;
1256
1257 if ((URI == NULL) || (initFunc == NULL))
1258 return (-1);
1259 if (xsltExtensionsHash == NULL)
1261
1262 if (xsltExtensionsHash == NULL)
1263 return (-1);
1264
1266
1268 if (module != NULL) {
1269 if ((module->initFunc == initFunc) &&
1270 (module->shutdownFunc == shutdownFunc))
1271 ret = 0;
1272 else
1273 ret = -1;
1274 goto done;
1275 }
1276 module = xsltNewExtModule(initFunc, shutdownFunc,
1277 styleInitFunc, styleShutdownFunc);
1278 if (module == NULL) {
1279 ret = -1;
1280 goto done;
1281 }
1282 ret = xmlHashAddEntry(xsltExtensionsHash, URI, (void *) module);
1283
1284done:
1286 return (ret);
1287}
1288
1299int
1301 xsltExtInitFunction initFunc,
1302 xsltExtShutdownFunction shutdownFunc)
1303{
1304 return xsltRegisterExtModuleFull(URI, initFunc, shutdownFunc,
1305 NULL, NULL);
1306}
1307
1316int
1318{
1319 int ret;
1320
1321 if (URI == NULL)
1322 return (-1);
1323 if (xsltExtensionsHash == NULL)
1324 return (-1);
1325
1327
1329
1331
1332 return (ret);
1333}
1334
1340static void
1342{
1343 if (xsltExtensionsHash == NULL)
1344 return;
1345
1347
1350
1352}
1353
1367xsltXPathGetTransformContext(xmlXPathParserContextPtr ctxt)
1368{
1369 if ((ctxt == NULL) || (ctxt->context == NULL))
1370 return (NULL);
1371 return (ctxt->context->extra);
1372}
1373
1384int
1386 xmlXPathFunction function)
1387{
1388 if ((name == NULL) || (URI == NULL) || (function == NULL))
1389 return (-1);
1390
1391 if (xsltFunctionsHash == NULL)
1393 if (xsltFunctionsHash == NULL)
1394 return (-1);
1395
1397
1399 XML_CAST_FPTR(function), NULL);
1400
1402
1403 return (0);
1404}
1405
1415xmlXPathFunction
1417{
1418 xmlXPathFunction ret;
1419
1420 if ((xsltFunctionsHash == NULL) || (name == NULL) || (URI == NULL))
1421 return (NULL);
1422
1424
1426
1428
1429 /* if lookup fails, attempt a dynamic load on supported platforms */
1430 if (NULL == ret) {
1431 if (!xsltExtModuleRegisterDynamic(URI)) {
1433
1436
1438 }
1439 }
1440
1441 return ret;
1442}
1443
1453int
1455{
1456 int ret;
1457
1458 if ((xsltFunctionsHash == NULL) || (name == NULL) || (URI == NULL))
1459 return (-1);
1460
1462
1464
1466
1467 return(ret);
1468}
1469
1475static void
1477{
1479
1482
1484}
1485
1486
1487static void
1489 xmlFree(comp);
1490}
1491
1504 xsltTransformFunction function)
1505{
1507
1509 if (cur == NULL) {
1511 "xsltNewExtElement : malloc failed\n");
1512 return (NULL);
1513 }
1514 memset(cur, 0, sizeof(xsltElemPreComp));
1515
1517
1518 return (cur);
1519}
1520
1534void
1536 xmlNodePtr inst, xsltTransformFunction function,
1538{
1539 comp->type = XSLT_FUNC_EXTENSION;
1540 comp->func = function;
1541 comp->inst = inst;
1542 comp->free = freeFunc;
1543
1544 comp->next = style->preComps;
1545 style->preComps = comp;
1546}
1547
1559{
1561 xsltElemPreCompPtr comp = NULL;
1562
1563 if ((style == NULL) || (inst == NULL) ||
1564 (inst->type != XML_ELEMENT_NODE) || (inst->ns == NULL))
1565 return (NULL);
1566
1568
1570 xmlHashLookup2(xsltElementsHash, inst->name, inst->ns->href);
1571
1573
1574 /*
1575 * EXT TODO: Now what?
1576 */
1577 if (ext == NULL)
1578 return (NULL);
1579
1580 if (ext->precomp != NULL) {
1581 /*
1582 * REVISIT TODO: Check if the text below is correct.
1583 * This will return a xsltElemPreComp structure or NULL.
1584 * 1) If the the author of the extension needs a
1585 * custom structure to hold the specific values of
1586 * this extension, he will derive a structure based on
1587 * xsltElemPreComp; thus we obviously *cannot* refactor
1588 * the xsltElemPreComp structure, since all already derived
1589 * user-defined strucures will break.
1590 * Example: For the extension xsl:document,
1591 * in xsltDocumentComp() (preproc.c), the structure
1592 * xsltStyleItemDocument is allocated, filled with
1593 * specific values and returned.
1594 * 2) If the author needs no values to be stored in
1595 * this structure, then he'll return NULL;
1596 */
1597 comp = ext->precomp(style, inst, ext->transform);
1598 }
1599 if (comp == NULL) {
1600 /*
1601 * Default creation of a xsltElemPreComp structure, if
1602 * the author of this extension did not create a custom
1603 * structure.
1604 */
1605 comp = xsltNewElemPreComp(style, inst, ext->transform);
1606 }
1607
1608 return (comp);
1609}
1610
1622int
1624 xsltPreComputeFunction precomp,
1626{
1627 int ret = 0;
1628
1630
1631 if ((name == NULL) || (URI == NULL) || (transform == NULL))
1632 return (-1);
1633
1634 if (xsltElementsHash == NULL)
1636 if (xsltElementsHash == NULL)
1637 return (-1);
1638
1640
1641 ext = xsltNewExtElement(precomp, transform);
1642 if (ext == NULL) {
1643 ret = -1;
1644 goto done;
1645 }
1646
1649
1650done:
1652
1653 return (ret);
1654}
1655
1669 const xmlChar * name, const xmlChar * URI)
1670{
1672
1673 if ((name == NULL) || (URI == NULL))
1674 return (NULL);
1675
1676 if ((ctxt != NULL) && (ctxt->extElements != NULL)) {
1678 if (ret != NULL) {
1679 return(ret);
1680 }
1681 }
1682
1684
1685 return (ret);
1686}
1687
1699{
1701
1702 if ((xsltElementsHash == NULL) || (name == NULL) || (URI == NULL))
1703 return (NULL);
1704
1706
1708
1710
1711 /*
1712 * if function lookup fails, attempt a dynamic load on
1713 * supported platforms
1714 */
1715 if (NULL == ext) {
1716 if (!xsltExtModuleRegisterDynamic(URI)) {
1718
1721
1723 }
1724 }
1725
1726 if (ext == NULL)
1727 return (NULL);
1728 return (ext->transform);
1729}
1730
1742 const xmlChar * URI)
1743{
1745
1746 if ((xsltElementsHash == NULL) || (name == NULL) || (URI == NULL))
1747 return (NULL);
1748
1750
1752
1754
1755 if (ext == NULL) {
1756 if (!xsltExtModuleRegisterDynamic(URI)) {
1758
1761
1763 }
1764 }
1765
1766 if (ext == NULL)
1767 return (NULL);
1768 return (ext->precomp);
1769}
1770
1780int
1782{
1783 int ret;
1784
1785 if ((xsltElementsHash == NULL) || (name == NULL) || (URI == NULL))
1786 return (-1);
1787
1789
1792
1794
1795 return(ret);
1796}
1797
1803static void
1805{
1807
1810
1812}
1813
1824int
1826 xsltTopLevelFunction function)
1827{
1828 if ((name == NULL) || (URI == NULL) || (function == NULL))
1829 return (-1);
1830
1831 if (xsltTopLevelsHash == NULL)
1833 if (xsltTopLevelsHash == NULL)
1834 return (-1);
1835
1837
1839 XML_CAST_FPTR(function), NULL);
1840
1842
1843 return (0);
1844}
1845
1857{
1859
1860 if ((xsltTopLevelsHash == NULL) || (name == NULL) || (URI == NULL))
1861 return (NULL);
1862
1864
1866
1868
1869 /* if lookup fails, attempt a dynamic load on supported platforms */
1870 if (NULL == ret) {
1871 if (!xsltExtModuleRegisterDynamic(URI)) {
1873
1875
1877 }
1878 }
1879
1880 return (ret);
1881}
1882
1892int
1894{
1895 int ret;
1896
1897 if ((xsltTopLevelsHash == NULL) || (name == NULL) || (URI == NULL))
1898 return (-1);
1899
1901
1903
1905
1906 return(ret);
1907}
1908
1914static void
1916{
1918
1921
1923}
1924
1936{
1938
1939 /*
1940 * TODO: Why do we have a return type of xmlHashTablePtr?
1941 * Is the user-allocated data for extension modules expected
1942 * to be a xmlHashTablePtr only? Or is this intended for
1943 * the EXSLT module only?
1944 */
1945
1946 if (style != NULL && style->extInfos != NULL) {
1947 data = xmlHashLookup(style->extInfos, URI);
1948 if (data != NULL && data->extData != NULL)
1949 return data->extData;
1950 }
1951 return NULL;
1952}
1953
1954/************************************************************************
1955 * *
1956 * Test of the extension module API *
1957 * *
1958 ************************************************************************/
1959
1962
1970static void
1971xsltExtFunctionTest(xmlXPathParserContextPtr ctxt,
1972 int nargs ATTRIBUTE_UNUSED)
1973{
1975 void *data = NULL;
1976
1977 tctxt = xsltXPathGetTransformContext(ctxt);
1978
1979 if (testData == NULL) {
1981 "xsltExtFunctionTest: not initialized,"
1982 " calling xsltGetExtData\n");
1983 data = xsltGetExtData(tctxt, (const xmlChar *) XSLT_DEFAULT_URL);
1984 if (data == NULL) {
1986 "xsltExtElementTest: not initialized\n");
1987 return;
1988 }
1989 }
1990 if (tctxt == NULL) {
1992 "xsltExtFunctionTest: failed to get the transformation context\n");
1993 return;
1994 }
1995 if (data == NULL)
1996 data = xsltGetExtData(tctxt, (const xmlChar *) XSLT_DEFAULT_URL);
1997 if (data == NULL) {
1999 "xsltExtFunctionTest: failed to get module data\n");
2000 return;
2001 }
2002 if (data != testData) {
2004 "xsltExtFunctionTest: got wrong module data\n");
2005 return;
2006 }
2007#ifdef WITH_XSLT_DEBUG_FUNCTION
2009 "libxslt:test() called with %d args\n", nargs);
2010#endif
2011}
2012
2020static xsltElemPreCompPtr
2022 xsltTransformFunction function)
2023{
2025
2026 if (style == NULL) {
2028 "xsltExtElementTest: no transformation context\n");
2029 return (NULL);
2030 }
2031 if (testStyleData == NULL) {
2033 "xsltExtElementPreCompTest: not initialized,"
2034 " calling xsltStyleGetExtData\n");
2036 if (testStyleData == NULL) {
2038 "xsltExtElementPreCompTest: not initialized\n");
2039 if (style != NULL)
2040 style->errors++;
2041 return (NULL);
2042 }
2043 }
2044 if (inst == NULL) {
2046 "xsltExtElementPreCompTest: no instruction\n");
2047 if (style != NULL)
2048 style->errors++;
2049 return (NULL);
2050 }
2051 ret = xsltNewElemPreComp(style, inst, function);
2052 return (ret);
2053}
2054
2064static void
2066 xmlNodePtr inst,
2068{
2069 xmlNodePtr commentNode;
2070
2071 if (testData == NULL) {
2073 "xsltExtElementTest: not initialized,"
2074 " calling xsltGetExtData\n");
2075 xsltGetExtData(ctxt, (const xmlChar *) XSLT_DEFAULT_URL);
2076 if (testData == NULL) {
2077 xsltTransformError(ctxt, NULL, inst,
2078 "xsltExtElementTest: not initialized\n");
2079 return;
2080 }
2081 }
2082 if (ctxt == NULL) {
2083 xsltTransformError(ctxt, NULL, inst,
2084 "xsltExtElementTest: no transformation context\n");
2085 return;
2086 }
2087 if (node == NULL) {
2088 xsltTransformError(ctxt, NULL, inst,
2089 "xsltExtElementTest: no current node\n");
2090 return;
2091 }
2092 if (inst == NULL) {
2093 xsltTransformError(ctxt, NULL, inst,
2094 "xsltExtElementTest: no instruction\n");
2095 return;
2096 }
2097 if (ctxt->insert == NULL) {
2098 xsltTransformError(ctxt, NULL, inst,
2099 "xsltExtElementTest: no insertion point\n");
2100 return;
2101 }
2102 commentNode = xmlNewComment((const xmlChar *)
2103 "libxslt:test element test worked");
2104 xmlAddChild(ctxt->insert, commentNode);
2105}
2106
2116static void *
2118{
2119 if (testStyleData == NULL) {
2121 "xsltExtInitTest: not initialized,"
2122 " calling xsltStyleGetExtData\n");
2124 if (testStyleData == NULL) {
2126 "xsltExtInitTest: not initialized\n");
2127 return (NULL);
2128 }
2129 }
2130 if (testData != NULL) {
2132 "xsltExtInitTest: already initialized\n");
2133 return (NULL);
2134 }
2135 testData = (void *) "test data";
2137 "Registered test module : %s\n", URI);
2138 return (testData);
2139}
2140
2141
2150static void
2152 const xmlChar * URI, void *data)
2153{
2154 if (testData == NULL) {
2156 "xsltExtShutdownTest: not initialized\n");
2157 return;
2158 }
2159 if (data != testData) {
2161 "xsltExtShutdownTest: wrong data\n");
2162 }
2163 testData = NULL;
2165 "Unregistered test module : %s\n", URI);
2166}
2167
2177static void *
2179 const xmlChar * URI)
2180{
2181 if (testStyleData != NULL) {
2183 "xsltExtInitTest: already initialized\n");
2184 return (NULL);
2185 }
2186 testStyleData = (void *) "test data";
2188 "Registered test module : %s\n", URI);
2189 return (testStyleData);
2190}
2191
2192
2201static void
2203 const xmlChar * URI, void *data)
2204{
2205 if (testStyleData == NULL) {
2207 "xsltExtShutdownTest: not initialized\n");
2208 return;
2209 }
2210 if (data != testStyleData) {
2212 "xsltExtShutdownTest: wrong data\n");
2213 }
2216 "Unregistered test module : %s\n", URI);
2217}
2218
2224void
2226{
2232 xsltRegisterExtModuleFunction((const xmlChar *) "test",
2233 (const xmlChar *) XSLT_DEFAULT_URL,
2235 xsltRegisterExtModuleElement((const xmlChar *) "test",
2236 (const xmlChar *) XSLT_DEFAULT_URL,
2239}
2240
2241static void
2243 void *data ATTRIBUTE_UNUSED,
2245{
2246#ifdef WITH_MODULES
2247 xmlModuleClose(payload);
2248#endif
2249}
2250
2256void
2258{
2259 if (xsltExtMutex == NULL) {
2261 }
2262}
2263
2269void
2271{
2276
2278 /* cleanup dynamic module hash */
2279 if (NULL != xsltModuleHash) {
2283 }
2285
2289 xsltUninit();
2290}
2291
2292static void
2294 void *data, const xmlChar * name,
2295 const xmlChar * URI,
2296 const xmlChar * not_used ATTRIBUTE_UNUSED)
2297{
2298 FILE *output = (FILE *) data;
2299 if (!name || !URI)
2300 return;
2301 fprintf(output, "{%s}%s\n", URI, name);
2302}
2303
2304static void
2306 void *data, const xmlChar * URI,
2307 const xmlChar * not_used ATTRIBUTE_UNUSED,
2308 const xmlChar * not_used2 ATTRIBUTE_UNUSED)
2309{
2310 FILE *output = (FILE *) data;
2311 if (!URI)
2312 return;
2313 fprintf(output, "%s\n", URI);
2314}
2315
2322void
2324{
2325 if (output == NULL)
2326 output = stdout;
2327 fprintf(output,
2328 "Registered XSLT Extensions\n--------------------------\n");
2329 if (!xsltFunctionsHash)
2330 fprintf(output, "No registered extension functions\n");
2331 else {
2332 fprintf(output, "Registered Extension Functions:\n");
2335 output);
2337 }
2338 if (!xsltElementsHash)
2339 fprintf(output, "\nNo registered extension elements\n");
2340 else {
2341 fprintf(output, "\nRegistered Extension Elements:\n");
2344 output);
2346 }
2347 if (!xsltExtensionsHash)
2348 fprintf(output, "\nNo registered extension modules\n");
2349 else {
2350 fprintf(output, "\nRegistered Extension Modules:\n");
2353 output);
2355 }
2356
2357}
int xsltUnregisterExtModuleElement(const xmlChar *name, const xmlChar *URI)
Definition: extensions.c:1781
int xsltUnregisterExtModule(const xmlChar *URI)
Definition: extensions.c:1317
int xsltCheckExtURI(xsltStylesheetPtr style, const xmlChar *URI)
Definition: extensions.c:1218
static xmlChar * testData
Definition: extensions.c:1960
static void xsltExtStyleShutdownTest(xsltStylesheetPtr style ATTRIBUTE_UNUSED, const xmlChar *URI, void *data)
Definition: extensions.c:2202
int xsltUnregisterExtModuleFunction(const xmlChar *name, const xmlChar *URI)
Definition: extensions.c:1454
int xsltRegisterExtFunction(xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *URI, xmlXPathFunction function)
Definition: extensions.c:587
static xmlHashTablePtr xsltModuleHash
Definition: extensions.c:71
int xsltInitCtxtExts(xsltTransformContextPtr ctxt)
Definition: extensions.c:1016
static void xsltShutdownExt(void *payload, void *vctxt, const xmlChar *URI)
Definition: extensions.c:1101
int xsltCheckExtPrefix(xsltStylesheetPtr style, const xmlChar *URI)
Definition: extensions.c:1158
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:72
static void xsltExtFunctionTest(xmlXPathParserContextPtr ctxt, int nargs ATTRIBUTE_UNUSED)
Definition: extensions.c:1971
void xsltDebugDumpExtensions(FILE *output)
Definition: extensions.c:2323
static xsltExtModulePtr xsltNewExtModule(xsltExtInitFunction initFunc, xsltExtShutdownFunction shutdownFunc, xsltStyleExtInitFunction styleInitFunc, xsltStyleExtShutdownFunction styleShutdownFunc)
Definition: extensions.c:156
int xsltRegisterExtElement(xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *URI, xsltTransformFunction function)
Definition: extensions.c:621
xsltPreComputeFunction xsltExtModuleElementPreComputeLookup(const xmlChar *name, const xmlChar *URI)
Definition: extensions.c:1741
static void xsltFreeExtModuleEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: extensions.c:191
static xsltExtElementPtr xsltNewExtElement(xsltPreComputeFunction precomp, xsltTransformFunction transform)
Definition: extensions.c:252
static int xsltExtModuleRegisterDynamic(const xmlChar *URI ATTRIBUTE_UNUSED)
Definition: extensions.c:459
static xsltExtDataPtr xsltStyleInitializeStylesheetModule(xsltStylesheetPtr style, const xmlChar *URI)
Definition: extensions.c:663
void * xsltGetExtData(xsltTransformContextPtr ctxt, const xmlChar *URI)
Definition: extensions.c:862
static void * xsltExtInitTest(xsltTransformContextPtr ctxt, const xmlChar *URI)
Definition: extensions.c:2117
static void xsltUnregisterAllExtModuleElement(void)
Definition: extensions.c:1804
int xsltRegisterExtModuleFull(const xmlChar *URI, xsltExtInitFunction initFunc, xsltExtShutdownFunction shutdownFunc, xsltStyleExtInitFunction styleInitFunc, xsltStyleExtShutdownFunction styleShutdownFunc)
Definition: extensions.c:1248
static void * xsltExtStyleInitTest(xsltStylesheetPtr style ATTRIBUTE_UNUSED, const xmlChar *URI)
Definition: extensions.c:2178
static void xsltDebugDumpExtModulesCallback(void *function ATTRIBUTE_UNUSED, void *data, const xmlChar *URI, const xmlChar *not_used ATTRIBUTE_UNUSED, const xmlChar *not_used2 ATTRIBUTE_UNUSED)
Definition: extensions.c:2305
static xmlHashTablePtr xsltTopLevelsHash
Definition: extensions.c:70
static void xsltFreeExtData(xsltExtDataPtr ext)
Definition: extensions.c:229
int xsltRegisterExtModuleTopLevel(const xmlChar *name, const xmlChar *URI, xsltTopLevelFunction function)
Definition: extensions.c:1825
void xsltRegisterTestModule(void)
Definition: extensions.c:2225
static xmlChar * testStyleData
Definition: extensions.c:1961
static void xsltUnregisterAllExtModules(void)
Definition: extensions.c:1341
int xsltRegisterExtModule(const xmlChar *URI, xsltExtInitFunction initFunc, xsltExtShutdownFunction shutdownFunc)
Definition: extensions.c:1300
void xsltFreeCtxtExts(xsltTransformContextPtr ctxt)
Definition: extensions.c:642
static void xsltUnregisterAllExtModuleFunction(void)
Definition: extensions.c:1476
xsltExtModule * xsltExtModulePtr
Definition: extensions.c:45
static void xsltFreeExtDefList(xsltExtDefPtr extensiond)
Definition: extensions.c:133
static void xsltFreeElemPreComp(xsltElemPreCompPtr comp)
Definition: extensions.c:1488
static xsltExtDataPtr xsltNewExtData(xsltExtModulePtr extModule, void *extData)
Definition: extensions.c:205
xsltTransformFunction xsltExtModuleElementLookup(const xmlChar *name, const xmlChar *URI)
Definition: extensions.c:1698
xsltElemPreCompPtr xsltPreComputeExtModuleElement(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: extensions.c:1558
static xsltExtDefPtr xsltNewExtDef(const xmlChar *prefix, const xmlChar *URI)
Definition: extensions.c:90
xsltExtElement * xsltExtElementPtr
Definition: extensions.c:61
xsltTransformContextPtr xsltXPathGetTransformContext(xmlXPathParserContextPtr ctxt)
Definition: extensions.c:1367
void xsltShutdownExts(xsltStylesheetPtr style)
Definition: extensions.c:1133
static void xsltShutdownCtxtExt(void *payload, void *vctxt, const xmlChar *URI)
Definition: extensions.c:1055
xsltExtData * xsltExtDataPtr
Definition: extensions.c:54
static void xsltFreeExtDef(xsltExtDefPtr extensiond)
Definition: extensions.c:115
xsltElemPreCompPtr xsltNewElemPreComp(xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function)
Definition: extensions.c:1503
static void xsltFreeExtDataEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: extensions.c:237
static xmlHashTablePtr xsltFunctionsHash
Definition: extensions.c:68
void xsltInitElemPreComp(xsltElemPreCompPtr comp, xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function, xsltElemPreCompDeallocator freeFunc)
Definition: extensions.c:1535
int xsltRegisterExtModuleElement(const xmlChar *name, const xmlChar *URI, xsltPreComputeFunction precomp, xsltTransformFunction transform)
Definition: extensions.c:1623
static void xsltUnregisterAllExtModuleTopLevel(void)
Definition: extensions.c:1915
static void xsltHashScannerModuleFree(void *payload ATTRIBUTE_UNUSED, void *data ATTRIBUTE_UNUSED, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: extensions.c:2242
xmlXPathFunction xsltExtModuleFunctionLookup(const xmlChar *name, const xmlChar *URI)
Definition: extensions.c:1416
xsltTransformFunction xsltExtElementLookup(xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *URI)
Definition: extensions.c:1668
static xsltElemPreCompPtr xsltExtElementPreCompTest(xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function)
Definition: extensions.c:2021
static void xsltInitCtxtExt(void *payload, void *data, const xmlChar *URI)
Definition: extensions.c:937
static xmlHashTablePtr xsltElementsHash
Definition: extensions.c:69
void xsltCleanupGlobals(void)
Definition: extensions.c:2270
static void xsltFreeExtElement(xsltExtElementPtr ext)
Definition: extensions.c:278
static void xsltExtElementTest(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr comp ATTRIBUTE_UNUSED)
Definition: extensions.c:2065
static void xsltFreeExtModule(xsltExtModulePtr ext)
Definition: extensions.c:183
static void xsltExtShutdownTest(xsltTransformContextPtr ctxt, const xmlChar *URI, void *data)
Definition: extensions.c:2151
void xsltInitGlobals(void)
Definition: extensions.c:2257
static xmlHashTablePtr xsltExtensionsHash
Definition: extensions.c:67
static void xsltFreeExtElementEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: extensions.c:286
xmlHashTablePtr xsltGetExtInfo(xsltStylesheetPtr style, const xmlChar *URI)
Definition: extensions.c:1935
static void xsltDebugDumpExtensionsCallback(void *function ATTRIBUTE_UNUSED, void *data, const xmlChar *name, const xmlChar *URI, const xmlChar *not_used ATTRIBUTE_UNUSED)
Definition: extensions.c:2293
void xsltShutdownCtxtExts(xsltTransformContextPtr ctxt)
Definition: extensions.c:1081
xsltExtDef * xsltExtDefPtr
Definition: extensions.c:36
int xsltRegisterExtModuleFunction(const xmlChar *name, const xmlChar *URI, xmlXPathFunction function)
Definition: extensions.c:1385
void * xsltStyleGetExtData(xsltStylesheetPtr style, const xmlChar *URI)
Definition: extensions.c:756
void xsltFreeExts(xsltStylesheetPtr style)
Definition: extensions.c:479
int xsltRegisterExtPrefix(xsltStylesheetPtr style, const xmlChar *prefix, const xmlChar *URI)
Definition: extensions.c:503
int xsltUnregisterExtModuleTopLevel(const xmlChar *name, const xmlChar *URI)
Definition: extensions.c:1893
xsltTopLevelFunction xsltExtModuleTopLevelLookup(const xmlChar *name, const xmlChar *URI)
Definition: extensions.c:1856
Arabic default style
Definition: afstyles.h:94
#define PATH_MAX
Definition: types.h:280
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
Definition: list.h:37
#define NULL
Definition: types.h:112
static const WCHAR *const ext[]
Definition: module.c:53
void(* xsltStyleExtShutdownFunction)(xsltStylesheetPtr style, const xmlChar *URI, void *data)
Definition: extensions.h:56
void(* xsltTopLevelFunction)(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: extensions.h:183
void *(* xsltExtInitFunction)(xsltTransformContextPtr ctxt, const xmlChar *URI)
Definition: extensions.h:69
void *(* xsltStyleExtInitFunction)(xsltStylesheetPtr style, const xmlChar *URI)
Definition: extensions.h:45
void(* xsltExtShutdownFunction)(xsltTransformContextPtr ctxt, const xmlChar *URI, void *data)
Definition: extensions.h:80
xsltElemPreCompPtr(* xsltPreComputeFunction)(xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function)
Definition: extensions.h:142
FxCollectionEntry * cur
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint GLenum GLenum transform
Definition: glext.h:9407
const GLfloat * m
Definition: glext.h:10848
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ATTRIBUTE_UNUSED
Definition: i386-dis.c:36
xsltStylesheetPtr xsltNextImport(xsltStylesheetPtr cur)
Definition: imports.c:251
#define stdout
Definition: stdio.h:99
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
if(dx< 0)
Definition: linetemp.h:194
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:248
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:251
XMLPUBFUN int XMLCALL xmlHashUpdateEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata, xmlHashDeallocator f)
Definition: hash.c:445
XMLPUBFUN int XMLCALL xmlHashAddEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, void *userdata)
Definition: hash.c:406
XMLPUBFUN void XMLCALL xmlHashFree(xmlHashTablePtr table, xmlHashDeallocator f)
Definition: hash.c:322
XMLPUBFUN void *XMLCALL xmlHashLookup(xmlHashTablePtr table, const xmlChar *name)
Definition: hash.c:461
#define XML_CAST_FPTR(fptr)
Definition: hash.h:56
XMLPUBFUN int XMLCALL xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, xmlHashDeallocator f)
Definition: hash.c:1071
XMLPUBFUN xmlHashTablePtr XMLCALL xmlHashCreate(int size)
Definition: hash.c:176
XMLPUBFUN void XMLCALL xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data)
Definition: hash.c:875
XMLPUBFUN int XMLCALL xmlHashAddEntry(xmlHashTablePtr table, const xmlChar *name, void *userdata)
Definition: hash.c:389
XMLPUBFUN int XMLCALL xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, xmlHashDeallocator f)
Definition: hash.c:1052
XMLPUBFUN void *XMLCALL xmlHashLookup2(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2)
Definition: hash.c:476
XMLPUBFUN void XMLCALL xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data)
Definition: hash.c:859
XMLPUBFUN xmlNodePtr XMLCALL xmlAddChild(xmlNodePtr parent, xmlNodePtr cur)
XMLPUBFUN xmlNodePtr XMLCALL xmlNewComment(const xmlChar *content)
@ XML_ELEMENT_NODE
Definition: tree.h:160
#define memset(x, y, z)
Definition: compat.h:39
Definition: tree.h:489
const xmlChar * name
Definition: tree.h:492
xmlElementType type
Definition: tree.h:491
xmlNs * ns
Definition: tree.h:501
const xmlChar * href
Definition: tree.h:392
xsltElemPreCompDeallocator free
xsltElemPreCompPtr next
xsltStyleType type
xsltTransformFunction func
void * extData
Definition: extensions.c:57
xsltExtModulePtr extModule
Definition: extensions.c:56
xmlChar * URI
Definition: extensions.c:40
struct _xsltExtDef * next
Definition: extensions.c:38
void * data
Definition: extensions.c:41
xmlChar * prefix
Definition: extensions.c:39
xsltPreComputeFunction precomp
Definition: extensions.c:63
xsltTransformFunction transform
Definition: extensions.c:64
xsltExtInitFunction initFunc
Definition: extensions.c:47
xsltExtShutdownFunction shutdownFunc
Definition: extensions.c:48
xsltStyleExtInitFunction styleInitFunc
Definition: extensions.c:49
xsltStyleExtShutdownFunction styleShutdownFunc
Definition: extensions.c:50
xsltTransformContextPtr ctxt
Definition: extensions.c:924
struct _xsltStylesheet * parent
xmlHashTablePtr extInfos
xmlHashTablePtr extElements
xmlHashTablePtr extFunctions
xmlHashTablePtr extInfos
xsltStylesheetPtr style
xmlXPathContextPtr xpathCtxt
Definition: fs.h:78
Definition: name.c:39
XMLPUBFUN void XMLCALL xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:248
XMLPUBFUN xmlMutexPtr XMLCALL xmlNewMutex(void)
Definition: threads.c:168
XMLPUBFUN void XMLCALL xmlFreeMutex(xmlMutexPtr tok)
Definition: threads.c:197
XMLPUBFUN void XMLCALL xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:220
Definition: dlist.c:348
int ret
XMLPUBFUN int XMLCALL xmlCheckFilename(const char *path)
XMLPUBFUN xmlChar *XMLCALL xmlStrcat(xmlChar *cur, const xmlChar *add)
Definition: xmlstring.c:524
XMLPUBFUN const xmlChar *XMLCALL xmlStrstr(const xmlChar *str, const xmlChar *val)
Definition: xmlstring.c:345
XMLPUBFUN int XMLCALL xmlStrPrintf(xmlChar *buf, int len, const char *msg,...) LIBXML_ATTR_FORMAT(3
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:67
#define BAD_CAST
Definition: xmlstring.h:35
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:160
unsigned char xmlChar
Definition: xmlstring.h:28
#define LIBXML_MODULE_EXTENSION
Definition: xmlversion.h:390
xsltTransformContext * xsltTransformContextPtr
@ XSLT_FUNC_EXTENSION
xsltElemPreComp * xsltElemPreCompPtr
xsltStylesheet * xsltStylesheetPtr
void(* xsltElemPreCompDeallocator)(xsltElemPreCompPtr comp)
void(* xsltTransformFunction)(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr comp)
void xsltUninit(void)
Definition: xslt.c:217
#define XSLT_DEFAULT_URL
Definition: xslt.h:39
void xsltFreeLocales(void)
Definition: xsltlocale.c:63
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:678
xmlGenericErrorFunc xsltGenericError
Definition: xsltutils.c:502
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:548
void * xsltGenericDebugContext
Definition: xsltutils.c:549
void * xsltGenericErrorContext
Definition: xsltutils.c:503