ReactOS 0.4.16-dev-2206-gc56950d
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#define IN_LIBXSLT
13#include "libxslt.h"
14
15#include <stdlib.h>
16#include <string.h>
17#include <limits.h>
18
19#include <libxml/xmlmemory.h>
20#include <libxml/tree.h>
21#include <libxml/hash.h>
22#include <libxml/xmlerror.h>
25#ifdef WITH_MODULES
26#include <libxml/xmlmodule.h>
27#endif
28#include <libxml/list.h>
29#include <libxml/xmlIO.h>
30#include <libxml/threads.h>
31#include "xslt.h"
32#include "xsltInternals.h"
33#include "xsltlocale.h"
34#include "xsltutils.h"
35#include "imports.h"
36#include "extensions.h"
37
38#ifdef _WIN32
39#include <stdlib.h> /* for _MAX_PATH */
40#ifndef PATH_MAX
41#define PATH_MAX _MAX_PATH
42#endif
43#endif
44
45#ifdef WITH_XSLT_DEBUG
46#define WITH_XSLT_DEBUG_EXTENSIONS
47#endif
48
49/************************************************************************
50 * *
51 * Private Types and Globals *
52 * *
53 ************************************************************************/
54
55typedef struct _xsltExtDef xsltExtDef;
61 void *data;
62};
63
71};
72
77 void *extData;
78};
79
85};
86
93
94/************************************************************************
95 * *
96 * Type functions *
97 * *
98 ************************************************************************/
99
109static xsltExtDefPtr
110xsltNewExtDef(const xmlChar * prefix, const xmlChar * URI)
111{
113
115 if (cur == NULL) {
117 "xsltNewExtDef : malloc failed\n");
118 return (NULL);
119 }
120 memset(cur, 0, sizeof(xsltExtDef));
121 if (prefix != NULL)
122 cur->prefix = xmlStrdup(prefix);
123 if (URI != NULL)
124 cur->URI = xmlStrdup(URI);
125 return (cur);
126}
127
134static void
136{
137 if (extensiond == NULL)
138 return;
139 if (extensiond->prefix != NULL)
140 xmlFree(extensiond->prefix);
141 if (extensiond->URI != NULL)
142 xmlFree(extensiond->URI);
143 xmlFree(extensiond);
144}
145
152static void
154{
156
157 while (extensiond != NULL) {
158 cur = extensiond;
159 extensiond = extensiond->next;
161 }
162}
163
175static xsltExtModulePtr
177 xsltExtShutdownFunction shutdownFunc,
178 xsltStyleExtInitFunction styleInitFunc,
179 xsltStyleExtShutdownFunction styleShutdownFunc)
180{
182
184 if (cur == NULL) {
186 "xsltNewExtModule : malloc failed\n");
187 return (NULL);
188 }
189 cur->initFunc = initFunc;
190 cur->shutdownFunc = shutdownFunc;
191 cur->styleInitFunc = styleInitFunc;
192 cur->styleShutdownFunc = styleShutdownFunc;
193 return (cur);
194}
195
202static void
204{
205 if (ext == NULL)
206 return;
207 xmlFree(ext);
208}
209
210static void
213}
214
224static xsltExtDataPtr
225xsltNewExtData(xsltExtModulePtr extModule, void *extData)
226{
228
229 if (extModule == NULL)
230 return (NULL);
232 if (cur == NULL) {
234 "xsltNewExtData : malloc failed\n");
235 return (NULL);
236 }
237 cur->extModule = extModule;
238 cur->extData = extData;
239 return (cur);
240}
241
248static void
250{
251 if (ext == NULL)
252 return;
253 xmlFree(ext);
254}
255
256static void
259}
260
274{
276
277 if (transform == NULL)
278 return (NULL);
279
281 if (cur == NULL) {
283 "xsltNewExtElement : malloc failed\n");
284 return (NULL);
285 }
286 cur->precomp = precomp;
287 cur->transform = transform;
288 return (cur);
289}
290
297static void
299{
300 if (ext == NULL)
301 return;
302 xmlFree(ext);
303}
304
305static void
308}
309
310
311#ifdef WITH_MODULES
312typedef void (*exsltRegisterFunction) (void);
313
314#ifndef PATH_MAX
315#define PATH_MAX 4096
316#endif
317
337static int
339{
340
341 xmlModulePtr m;
342 exsltRegisterFunction regfunc;
343 xmlChar *ext_name;
344 char module_filename[PATH_MAX];
345 const xmlChar *ext_directory = NULL;
346 const xmlChar *protocol = NULL;
347 xmlChar *i, *regfunc_name;
348 void *vregfunc;
349 int rc;
350
351 /* check for bad inputs */
352 if (URI == NULL)
353 return (-1);
354
355 if (NULL == xsltModuleHash) {
357 if (xsltModuleHash == NULL)
358 return (-1);
359 }
360
362
363 /* have we attempted to register this module already? */
364 if (xmlHashLookup(xsltModuleHash, URI) != NULL) {
366 return (-1);
367 }
369
370 /* transform extension namespace into a module name */
371 protocol = xmlStrstr(URI, BAD_CAST "://");
372 if (protocol == NULL) {
373 ext_name = xmlStrdup(URI);
374 } else {
375 ext_name = xmlStrdup(protocol + 3);
376 }
377 if (ext_name == NULL) {
378 return (-1);
379 }
380
381 i = ext_name;
382 while ('\0' != *i) {
383 if (('/' == *i) || ('\\' == *i) || ('.' == *i) || ('-' == *i))
384 *i = '_';
385 i++;
386 }
387
388 /* Strip underscores from end of string. */
389 while (i > ext_name && *(i - 1) == '_') {
390 i--;
391 *i = '\0';
392 }
393
394 /* determine module directory */
395 ext_directory = (xmlChar *) getenv("LIBXSLT_PLUGINS_PATH");
396
397 if (NULL == ext_directory) {
398 ext_directory = BAD_CAST LIBXSLT_DEFAULT_PLUGINS_PATH();
399 if (NULL == ext_directory)
400 return (-1);
401 }
402#ifdef WITH_XSLT_DEBUG_EXTENSIONS
403 else
405 "LIBXSLT_PLUGINS_PATH is %s\n", ext_directory);
406#endif
407
408 /* build the module filename, and confirm the module exists */
409 xmlStrPrintf((xmlChar *) module_filename, sizeof(module_filename),
410 "%s/%s%s", ext_directory, ext_name, LIBXML_MODULE_EXTENSION);
411
412#ifdef WITH_XSLT_DEBUG_EXTENSIONS
414 "Attempting to load plugin: %s for URI: %s\n",
415 module_filename, URI);
416#endif
417
418#if LIBXML_VERSION < 21300
419 if (1 != xmlCheckFilename(module_filename)) {
420
421#ifdef WITH_XSLT_DEBUG_EXTENSIONS
423 "xmlCheckFilename failed for plugin: %s\n", module_filename);
424#endif
425
426 xmlFree(ext_name);
427 return (-1);
428 }
429#endif
430
431 /* attempt to open the module */
432 m = xmlModuleOpen(module_filename, 0);
433 if (NULL == m) {
434
435#ifdef WITH_XSLT_DEBUG_EXTENSIONS
437 "xmlModuleOpen failed for plugin: %s\n", module_filename);
438#endif
439
440 xmlFree(ext_name);
441 return (-1);
442 }
443
444 /* construct initialization func name */
445 regfunc_name = xmlStrdup(ext_name);
446 regfunc_name = xmlStrcat(regfunc_name, BAD_CAST "_init");
447
448 vregfunc = NULL;
449 rc = xmlModuleSymbol(m, (const char *) regfunc_name, &vregfunc);
450 regfunc = vregfunc;
451 if (0 == rc) {
452 /*
453 * Call the module's init function. Note that this function
454 * calls xsltRegisterExtModuleFull which will add the module
455 * to xsltExtensionsHash (together with it's entry points).
456 */
457 (*regfunc) ();
458
459 /* register this module in our hash */
461 xmlHashAddEntry(xsltModuleHash, URI, (void *) m);
463 } else {
464
465#ifdef WITH_XSLT_DEBUG_EXTENSIONS
467 "xmlModuleSymbol failed for plugin: %s, regfunc: %s\n",
468 module_filename, regfunc_name);
469#endif
470
471 /* if regfunc not found unload the module immediately */
472 xmlModuleClose(m);
473 }
474
475 xmlFree(ext_name);
476 xmlFree(regfunc_name);
477 return (NULL == regfunc) ? -1 : 0;
478}
479#else
480static int
482{
483 return -1;
484}
485#endif
486
487/************************************************************************
488 * *
489 * The stylesheet extension prefixes handling *
490 * *
491 ************************************************************************/
492
493
500void
502{
503 if (style->nsDefs != NULL)
505}
506
524int
526 const xmlChar * prefix, const xmlChar * URI)
527{
528 xsltExtDefPtr def, ret;
529
530 if ((style == NULL) || (URI == NULL))
531 return (-1);
532
533#ifdef WITH_XSLT_DEBUG_EXTENSIONS
535 "Registering extension namespace '%s'.\n", URI);
536#endif
537 def = (xsltExtDefPtr) style->nsDefs;
538#ifdef XSLT_REFACTORED
539 /*
540 * The extension is associated with a namespace name.
541 */
542 while (def != NULL) {
543 if (xmlStrEqual(URI, def->URI))
544 return (1);
545 def = def->next;
546 }
547#else
548 while (def != NULL) {
549 if (xmlStrEqual(prefix, def->prefix))
550 return (-1);
551 def = def->next;
552 }
553#endif
554 ret = xsltNewExtDef(prefix, URI);
555 if (ret == NULL)
556 return (-1);
557 ret->next = (xsltExtDefPtr) style->nsDefs;
558 style->nsDefs = ret;
559
560 /*
561 * check whether there is an extension module with a stylesheet
562 * initialization function.
563 */
564#ifdef XSLT_REFACTORED
565 /*
566 * Don't initialize modules based on specified namespaces via
567 * the attribute "[xsl:]extension-element-prefixes".
568 */
569#else
572
576 if (NULL == module) {
581 }
582 }
583 if (module != NULL) {
585 }
586 }
587#endif
588 return (0);
589}
590
591/************************************************************************
592 * *
593 * The extensions modules interfaces *
594 * *
595 ************************************************************************/
596
608int
610 const xmlChar * URI, xmlXPathFunction function)
611{
612 int ret;
613
614 if ((ctxt == NULL) || (name == NULL) ||
615 (URI == NULL) || (function == NULL))
616 return (-1);
617 if (ctxt->xpathCtxt != NULL) {
618 xmlXPathRegisterFuncNS(ctxt->xpathCtxt, name, URI, function);
619 }
620 if (ctxt->extFunctions == NULL)
621 ctxt->extFunctions = xmlHashCreate(10);
622 if (ctxt->extFunctions == NULL)
623 return (-1);
624
626 XML_CAST_FPTR(function));
627
628 return(ret);
629}
630
642int
644 const xmlChar * URI, xsltTransformFunction function)
645{
646 if ((ctxt == NULL) || (name == NULL) ||
647 (URI == NULL) || (function == NULL))
648 return (-1);
649 if (ctxt->extElements == NULL)
650 ctxt->extElements = xmlHashCreate(10);
651 if (ctxt->extElements == NULL)
652 return (-1);
653 return (xmlHashAddEntry2
654 (ctxt->extElements, name, URI, XML_CAST_FPTR(function)));
655}
656
663void
665{
666 if (ctxt->extElements != NULL)
668 if (ctxt->extFunctions != NULL)
670}
671
684static xsltExtDataPtr
686 const xmlChar * URI)
687{
688 xsltExtDataPtr dataContainer;
689 void *userData = NULL;
691
692 if ((style == NULL) || (URI == NULL))
693 return(NULL);
694
695 if (xsltExtensionsHash == NULL) {
696#ifdef WITH_XSLT_DEBUG_EXTENSIONS
698 "Not registered extension module: %s\n", URI);
699#endif
700 return(NULL);
701 }
702
704
706
708
709 if (module == NULL) {
710#ifdef WITH_XSLT_DEBUG_EXTENSIONS
712 "Not registered extension module: %s\n", URI);
713#endif
714 return (NULL);
715 }
716 /*
717 * The specified module was registered so initialize it.
718 */
719 if (style->extInfos == NULL) {
720 style->extInfos = xmlHashCreate(10);
721 if (style->extInfos == NULL)
722 return (NULL);
723 }
724 /*
725 * Fire the initialization callback if available.
726 */
727 if (module->styleInitFunc == NULL) {
728#ifdef WITH_XSLT_DEBUG_EXTENSIONS
730 "Initializing module with *no* callback: %s\n", URI);
731#endif
732 } else {
733#ifdef WITH_XSLT_DEBUG_EXTENSIONS
735 "Initializing module with callback: %s\n", URI);
736#endif
737 /*
738 * Fire the initialization callback.
739 */
740 userData = module->styleInitFunc(style, URI);
741 }
742 /*
743 * Store the user-data in the context of the given stylesheet.
744 */
745 dataContainer = xsltNewExtData(module, userData);
746 if (dataContainer == NULL) {
747 if (module->styleShutdownFunc)
748 module->styleShutdownFunc(style, URI, userData);
749 return (NULL);
750 }
751
752 if (xmlHashAddEntry(style->extInfos, URI,
753 (void *) dataContainer) < 0)
754 {
756 "Failed to register module '%s'.\n", URI);
757 style->errors++;
758 if (module->styleShutdownFunc)
759 module->styleShutdownFunc(style, URI, userData);
760 xsltFreeExtData(dataContainer);
761 return (NULL);
762 }
763
764 return(dataContainer);
765}
766
780void *
782{
783 xsltExtDataPtr dataContainer = NULL;
784 xsltStylesheetPtr tmpStyle;
785
786 if ((style == NULL) || (URI == NULL) ||
788 return (NULL);
789
790
791#ifdef XSLT_REFACTORED
792 /*
793 * This is intended for global storage, so only the main
794 * stylesheet will hold the data.
795 */
796 tmpStyle = style;
797 while (tmpStyle->parent != NULL)
798 tmpStyle = tmpStyle->parent;
799 if (tmpStyle->extInfos != NULL) {
800 dataContainer =
801 (xsltExtDataPtr) xmlHashLookup(tmpStyle->extInfos, URI);
802 if (dataContainer != NULL) {
803 /*
804 * The module was already initialized in the context
805 * of this stylesheet; just return the user-data that
806 * comes with it.
807 */
808 return(dataContainer->extData);
809 }
810 }
811#else
812 /*
813 * Old behaviour.
814 */
815 tmpStyle = style;
816 if (tmpStyle->extInfos != NULL) {
817 dataContainer =
818 (xsltExtDataPtr) xmlHashLookup(tmpStyle->extInfos, URI);
819 if (dataContainer != NULL) {
820 return(dataContainer->extData);
821 }
822 }
823#endif
824
825 dataContainer =
827 if (dataContainer != NULL)
828 return (dataContainer->extData);
829 return(NULL);
830}
831
832#ifdef XSLT_REFACTORED
843void *
844xsltStyleStylesheetLevelGetExtData(xsltStylesheetPtr style,
845 const xmlChar * URI)
846{
847 xsltExtDataPtr dataContainer = NULL;
848
849 if ((style == NULL) || (URI == NULL) ||
851 return (NULL);
852
853 if (style->extInfos != NULL) {
854 dataContainer = (xsltExtDataPtr) xmlHashLookup(style->extInfos, URI);
855 /*
856 * The module was already initialized in the context
857 * of this stylesheet; just return the user-data that
858 * comes with it.
859 */
860 if (dataContainer)
861 return(dataContainer->extData);
862 }
863
864 dataContainer =
866 if (dataContainer != NULL)
867 return (dataContainer->extData);
868 return(NULL);
869}
870#endif
871
882void *
884{
886
887 if ((ctxt == NULL) || (URI == NULL))
888 return (NULL);
889 if (ctxt->extInfos == NULL) {
890 ctxt->extInfos = xmlHashCreate(10);
891 if (ctxt->extInfos == NULL)
892 return (NULL);
893 data = NULL;
894 } else {
896 }
897 if (data == NULL) {
898 void *extData;
900
902
904
906
907 if (module == NULL) {
908#ifdef WITH_XSLT_DEBUG_EXTENSIONS
910 "Not registered extension module: %s\n", URI);
911#endif
912 return (NULL);
913 } else {
914 if (module->initFunc == NULL)
915 return (NULL);
916
917#ifdef WITH_XSLT_DEBUG_EXTENSIONS
919 "Initializing module: %s\n", URI);
920#endif
921
922 extData = module->initFunc(ctxt, URI);
923 if (extData == NULL)
924 return (NULL);
925
926 data = xsltNewExtData(module, extData);
927 if ((data == NULL) ||
928 (xmlHashAddEntry(ctxt->extInfos, URI, (void *) data) < 0)) {
930 "Failed to register module data: %s\n",
931 URI);
932 if (module->shutdownFunc)
933 module->shutdownFunc(ctxt, URI, extData);
935 return (NULL);
936 }
937 }
938 }
939 return (data->extData);
940}
941
945 int ret;
946};
947
956static void
957xsltInitCtxtExt(void *payload, void *data, const xmlChar * URI)
958{
959 xsltExtDataPtr styleData = (xsltExtDataPtr) payload;
962 xsltExtDataPtr ctxtData;
963 void *extData;
964
965 if ((styleData == NULL) || (ctxt == NULL) || (URI == NULL) ||
966 (ctxt->ret == -1)) {
967#ifdef WITH_XSLT_DEBUG_EXTENSIONS
969 "xsltInitCtxtExt: NULL param or error\n");
970#endif
971 return;
972 }
973 module = styleData->extModule;
974 if ((module == NULL) || (module->initFunc == NULL)) {
975#ifdef WITH_XSLT_DEBUG_EXTENSIONS
977 "xsltInitCtxtExt: no module or no initFunc\n");
978#endif
979 return;
980 }
981
982 ctxtData = (xsltExtDataPtr) xmlHashLookup(ctxt->ctxt->extInfos, URI);
983 if (ctxtData != NULL) {
984#ifdef WITH_XSLT_DEBUG_EXTENSIONS
986 "xsltInitCtxtExt: already initialized\n");
987#endif
988 return;
989 }
990
991 extData = module->initFunc(ctxt->ctxt, URI);
992 if (extData == NULL) {
993#ifdef WITH_XSLT_DEBUG_EXTENSIONS
995 "xsltInitCtxtExt: no extData\n");
996#endif
997 }
998 ctxtData = xsltNewExtData(module, extData);
999 if (ctxtData == NULL) {
1000 if (module->shutdownFunc)
1001 module->shutdownFunc(ctxt->ctxt, URI, extData);
1002 ctxt->ret = -1;
1003 return;
1004 }
1005
1006 if (ctxt->ctxt->extInfos == NULL)
1007 ctxt->ctxt->extInfos = xmlHashCreate(10);
1008 if (ctxt->ctxt->extInfos == NULL) {
1009 if (module->shutdownFunc)
1010 module->shutdownFunc(ctxt->ctxt, URI, extData);
1011 xsltFreeExtData(ctxtData);
1012 ctxt->ret = -1;
1013 return;
1014 }
1015
1016 if (xmlHashAddEntry(ctxt->ctxt->extInfos, URI, ctxtData) < 0) {
1018 "Failed to register module data: %s\n", URI);
1019 if (module->shutdownFunc)
1020 module->shutdownFunc(ctxt->ctxt, URI, extData);
1021 xsltFreeExtData(ctxtData);
1022 ctxt->ret = -1;
1023 return;
1024 }
1025#ifdef WITH_XSLT_DEBUG_EXTENSIONS
1026 xsltGenericDebug(xsltGenericDebugContext, "Registered module %s\n",
1027 URI);
1028#endif
1029 ctxt->ret++;
1030}
1031
1040int
1042{
1045
1046 if (ctxt == NULL)
1047 return (-1);
1048
1049 style = ctxt->style;
1050 if (style == NULL)
1051 return (-1);
1052
1053 ctx.ctxt = ctxt;
1054 ctx.ret = 0;
1055
1056 while (style != NULL) {
1057 if (style->extInfos != NULL) {
1058 xmlHashScan(style->extInfos, xsltInitCtxtExt, &ctx);
1059 if (ctx.ret == -1)
1060 return (-1);
1061 }
1063 }
1064#ifdef WITH_XSLT_DEBUG_EXTENSIONS
1065 xsltGenericDebug(xsltGenericDebugContext, "Registered %d modules\n",
1066 ctx.ret);
1067#endif
1068 return (ctx.ret);
1069}
1070
1079static void
1080xsltShutdownCtxtExt(void *payload, void *vctxt, const xmlChar * URI)
1081{
1085
1086 if ((data == NULL) || (ctxt == NULL) || (URI == NULL))
1087 return;
1088 module = data->extModule;
1089 if ((module == NULL) || (module->shutdownFunc == NULL))
1090 return;
1091
1092#ifdef WITH_XSLT_DEBUG_EXTENSIONS
1094 "Shutting down module : %s\n", URI);
1095#endif
1096 module->shutdownFunc(ctxt, URI, data->extData);
1097}
1098
1105void
1107{
1108 if (ctxt == NULL)
1109 return;
1110 if (ctxt->extInfos == NULL)
1111 return;
1114 ctxt->extInfos = NULL;
1115}
1116
1125static void
1126xsltShutdownExt(void *payload, void *vctxt, const xmlChar * URI)
1127{
1131
1132 if ((data == NULL) || (style == NULL) || (URI == NULL))
1133 return;
1134 module = data->extModule;
1135 if ((module == NULL) || (module->styleShutdownFunc == NULL))
1136 return;
1137
1138#ifdef WITH_XSLT_DEBUG_EXTENSIONS
1140 "Shutting down module : %s\n", URI);
1141#endif
1142 module->styleShutdownFunc(style, URI, data->extData);
1143 /*
1144 * Don't remove the entry from the hash table here, since
1145 * this will produce segfaults - this fixes bug #340624.
1146 *
1147 * xmlHashRemoveEntry(style->extInfos, URI, xsltFreeExtDataEntry);
1148 */
1149}
1150
1157void
1159{
1160 if (style == NULL)
1161 return;
1162 if (style->extInfos == NULL)
1163 return;
1166 style->extInfos = NULL;
1167}
1168
1182int
1184{
1185#ifdef XSLT_REFACTORED
1186 if ((style == NULL) || (style->compCtxt == NULL) ||
1187 (XSLT_CCTXT(style)->inode == NULL) ||
1188 (XSLT_CCTXT(style)->inode->extElemNs == NULL))
1189 return (0);
1190 /*
1191 * Lookup the extension namespaces registered
1192 * at the current node in the stylesheet's tree.
1193 */
1194 if (XSLT_CCTXT(style)->inode->extElemNs != NULL) {
1195 int i;
1196 xsltPointerListPtr list = XSLT_CCTXT(style)->inode->extElemNs;
1197
1198 for (i = 0; i < list->number; i++) {
1199 if (xmlStrEqual((const xmlChar *) list->items[i],
1200 URI))
1201 {
1202 return(1);
1203 }
1204 }
1205 }
1206#else
1208
1209 if ((style == NULL) || (style->nsDefs == NULL))
1210 return (0);
1211 if (URI == NULL)
1212 URI = BAD_CAST "#default";
1213 cur = (xsltExtDefPtr) style->nsDefs;
1214 while (cur != NULL) {
1215 /*
1216 * NOTE: This was change to work on namespace names rather
1217 * than namespace prefixes. This fixes bug #339583.
1218 * TODO: Consider renaming the field "prefix" of xsltExtDef
1219 * to "href".
1220 */
1221 if (xmlStrEqual(URI, cur->prefix))
1222 return (1);
1223 cur = cur->next;
1224 }
1225#endif
1226 return (0);
1227}
1228
1242int
1244{
1246
1247 if ((style == NULL) || (style->nsDefs == NULL))
1248 return (0);
1249 if (URI == NULL)
1250 return (0);
1251 cur = (xsltExtDefPtr) style->nsDefs;
1252 while (cur != NULL) {
1253 if (xmlStrEqual(URI, cur->URI))
1254 return (1);
1255 cur = cur->next;
1256 }
1257 return (0);
1258}
1259
1272int
1274 xsltExtInitFunction initFunc,
1275 xsltExtShutdownFunction shutdownFunc,
1276 xsltStyleExtInitFunction styleInitFunc,
1277 xsltStyleExtShutdownFunction styleShutdownFunc)
1278{
1279 int ret;
1281
1282 if ((URI == NULL) || (initFunc == NULL))
1283 return (-1);
1284 if (xsltExtensionsHash == NULL)
1286
1287 if (xsltExtensionsHash == NULL)
1288 return (-1);
1289
1291
1293 if (module != NULL) {
1294 if ((module->initFunc == initFunc) &&
1295 (module->shutdownFunc == shutdownFunc))
1296 ret = 0;
1297 else
1298 ret = -1;
1299 goto done;
1300 }
1301 module = xsltNewExtModule(initFunc, shutdownFunc,
1302 styleInitFunc, styleShutdownFunc);
1303 if (module == NULL) {
1304 ret = -1;
1305 goto done;
1306 }
1307 ret = xmlHashAddEntry(xsltExtensionsHash, URI, (void *) module);
1308
1309done:
1311 return (ret);
1312}
1313
1324int
1326 xsltExtInitFunction initFunc,
1327 xsltExtShutdownFunction shutdownFunc)
1328{
1329 return xsltRegisterExtModuleFull(URI, initFunc, shutdownFunc,
1330 NULL, NULL);
1331}
1332
1341int
1343{
1344 int ret;
1345
1346 if (URI == NULL)
1347 return (-1);
1348 if (xsltExtensionsHash == NULL)
1349 return (-1);
1350
1352
1354
1356
1357 return (ret);
1358}
1359
1365static void
1367{
1368 if (xsltExtensionsHash == NULL)
1369 return;
1370
1372
1375
1377}
1378
1392xsltXPathGetTransformContext(xmlXPathParserContextPtr ctxt)
1393{
1394 if ((ctxt == NULL) || (ctxt->context == NULL))
1395 return (NULL);
1396 return (ctxt->context->extra);
1397}
1398
1409int
1411 xmlXPathFunction function)
1412{
1413 if ((name == NULL) || (URI == NULL) || (function == NULL))
1414 return (-1);
1415
1416 if (xsltFunctionsHash == NULL)
1418 if (xsltFunctionsHash == NULL)
1419 return (-1);
1420
1422
1424 XML_CAST_FPTR(function), NULL);
1425
1427
1428 return (0);
1429}
1430
1440xmlXPathFunction
1442{
1443 xmlXPathFunction ret;
1444
1445 if ((xsltFunctionsHash == NULL) || (name == NULL) || (URI == NULL))
1446 return (NULL);
1447
1449
1451
1453
1454 /* if lookup fails, attempt a dynamic load on supported platforms */
1455 if (NULL == ret) {
1456 if (!xsltExtModuleRegisterDynamic(URI)) {
1458
1461
1463 }
1464 }
1465
1466 return ret;
1467}
1468
1478int
1480{
1481 int ret;
1482
1483 if ((xsltFunctionsHash == NULL) || (name == NULL) || (URI == NULL))
1484 return (-1);
1485
1487
1489
1491
1492 return(ret);
1493}
1494
1500static void
1502{
1504
1507
1509}
1510
1511
1512static void
1514 xmlFree(comp);
1515}
1516
1529 xsltTransformFunction function)
1530{
1532
1534 if (cur == NULL) {
1536 "xsltNewExtElement : malloc failed\n");
1537 return (NULL);
1538 }
1539 memset(cur, 0, sizeof(xsltElemPreComp));
1540
1542
1543 return (cur);
1544}
1545
1559void
1561 xmlNodePtr inst, xsltTransformFunction function,
1563{
1564 comp->type = XSLT_FUNC_EXTENSION;
1565 comp->func = function;
1566 comp->inst = inst;
1567 comp->free = freeFunc;
1568
1569 comp->next = style->preComps;
1570 style->preComps = comp;
1571}
1572
1584{
1586 xsltElemPreCompPtr comp = NULL;
1587
1588 if ((style == NULL) || (inst == NULL) ||
1589 (inst->type != XML_ELEMENT_NODE) || (inst->ns == NULL))
1590 return (NULL);
1591
1593
1595 xmlHashLookup2(xsltElementsHash, inst->name, inst->ns->href);
1596
1598
1599 /*
1600 * EXT TODO: Now what?
1601 */
1602 if (ext == NULL)
1603 return (NULL);
1604
1605 if (ext->precomp != NULL) {
1606 /*
1607 * REVISIT TODO: Check if the text below is correct.
1608 * This will return a xsltElemPreComp structure or NULL.
1609 * 1) If the the author of the extension needs a
1610 * custom structure to hold the specific values of
1611 * this extension, he will derive a structure based on
1612 * xsltElemPreComp; thus we obviously *cannot* refactor
1613 * the xsltElemPreComp structure, since all already derived
1614 * user-defined strucures will break.
1615 * Example: For the extension xsl:document,
1616 * in xsltDocumentComp() (preproc.c), the structure
1617 * xsltStyleItemDocument is allocated, filled with
1618 * specific values and returned.
1619 * 2) If the author needs no values to be stored in
1620 * this structure, then he'll return NULL;
1621 */
1622 comp = ext->precomp(style, inst, ext->transform);
1623 }
1624 if (comp == NULL) {
1625 /*
1626 * Default creation of a xsltElemPreComp structure, if
1627 * the author of this extension did not create a custom
1628 * structure.
1629 */
1630 comp = xsltNewElemPreComp(style, inst, ext->transform);
1631 }
1632
1633 return (comp);
1634}
1635
1647int
1649 xsltPreComputeFunction precomp,
1651{
1652 int ret = 0;
1653
1655
1656 if ((name == NULL) || (URI == NULL) || (transform == NULL))
1657 return (-1);
1658
1659 if (xsltElementsHash == NULL)
1661 if (xsltElementsHash == NULL)
1662 return (-1);
1663
1665
1666 ext = xsltNewExtElement(precomp, transform);
1667 if (ext == NULL) {
1668 ret = -1;
1669 goto done;
1670 }
1671
1674
1675done:
1677
1678 return (ret);
1679}
1680
1694 const xmlChar * name, const xmlChar * URI)
1695{
1697
1698 if ((name == NULL) || (URI == NULL))
1699 return (NULL);
1700
1701 if ((ctxt != NULL) && (ctxt->extElements != NULL)) {
1703 if (ret != NULL) {
1704 return(ret);
1705 }
1706 }
1707
1709
1710 return (ret);
1711}
1712
1724{
1726
1727 if ((xsltElementsHash == NULL) || (name == NULL) || (URI == NULL))
1728 return (NULL);
1729
1731
1733
1735
1736 /*
1737 * if function lookup fails, attempt a dynamic load on
1738 * supported platforms
1739 */
1740 if (NULL == ext) {
1741 if (!xsltExtModuleRegisterDynamic(URI)) {
1743
1746
1748 }
1749 }
1750
1751 if (ext == NULL)
1752 return (NULL);
1753 return (ext->transform);
1754}
1755
1767 const xmlChar * URI)
1768{
1770
1771 if ((xsltElementsHash == NULL) || (name == NULL) || (URI == NULL))
1772 return (NULL);
1773
1775
1777
1779
1780 if (ext == NULL) {
1781 if (!xsltExtModuleRegisterDynamic(URI)) {
1783
1786
1788 }
1789 }
1790
1791 if (ext == NULL)
1792 return (NULL);
1793 return (ext->precomp);
1794}
1795
1805int
1807{
1808 int ret;
1809
1810 if ((xsltElementsHash == NULL) || (name == NULL) || (URI == NULL))
1811 return (-1);
1812
1814
1817
1819
1820 return(ret);
1821}
1822
1828static void
1830{
1832
1835
1837}
1838
1849int
1851 xsltTopLevelFunction function)
1852{
1853 if ((name == NULL) || (URI == NULL) || (function == NULL))
1854 return (-1);
1855
1856 if (xsltTopLevelsHash == NULL)
1858 if (xsltTopLevelsHash == NULL)
1859 return (-1);
1860
1862
1864 XML_CAST_FPTR(function), NULL);
1865
1867
1868 return (0);
1869}
1870
1882{
1884
1885 if ((xsltTopLevelsHash == NULL) || (name == NULL) || (URI == NULL))
1886 return (NULL);
1887
1889
1891
1893
1894 /* if lookup fails, attempt a dynamic load on supported platforms */
1895 if (NULL == ret) {
1896 if (!xsltExtModuleRegisterDynamic(URI)) {
1898
1900
1902 }
1903 }
1904
1905 return (ret);
1906}
1907
1917int
1919{
1920 int ret;
1921
1922 if ((xsltTopLevelsHash == NULL) || (name == NULL) || (URI == NULL))
1923 return (-1);
1924
1926
1928
1930
1931 return(ret);
1932}
1933
1939static void
1941{
1943
1946
1948}
1949
1961{
1963
1964 /*
1965 * TODO: Why do we have a return type of xmlHashTablePtr?
1966 * Is the user-allocated data for extension modules expected
1967 * to be a xmlHashTablePtr only? Or is this intended for
1968 * the EXSLT module only?
1969 */
1970
1971 if (style != NULL && style->extInfos != NULL) {
1972 data = xmlHashLookup(style->extInfos, URI);
1973 if (data != NULL && data->extData != NULL)
1974 return data->extData;
1975 }
1976 return NULL;
1977}
1978
1979/************************************************************************
1980 * *
1981 * Test of the extension module API *
1982 * *
1983 ************************************************************************/
1984
1987
1995static void
1996xsltExtFunctionTest(xmlXPathParserContextPtr ctxt,
1997 int nargs ATTRIBUTE_UNUSED)
1998{
2000 void *data = NULL;
2001
2002 tctxt = xsltXPathGetTransformContext(ctxt);
2003
2004 if (testData == NULL) {
2006 "xsltExtFunctionTest: not initialized,"
2007 " calling xsltGetExtData\n");
2008 data = xsltGetExtData(tctxt, (const xmlChar *) XSLT_DEFAULT_URL);
2009 if (data == NULL) {
2011 "xsltExtElementTest: not initialized\n");
2012 return;
2013 }
2014 }
2015 if (tctxt == NULL) {
2017 "xsltExtFunctionTest: failed to get the transformation context\n");
2018 return;
2019 }
2020 if (data == NULL)
2021 data = xsltGetExtData(tctxt, (const xmlChar *) XSLT_DEFAULT_URL);
2022 if (data == NULL) {
2024 "xsltExtFunctionTest: failed to get module data\n");
2025 return;
2026 }
2027 if (data != testData) {
2029 "xsltExtFunctionTest: got wrong module data\n");
2030 return;
2031 }
2032#ifdef WITH_XSLT_DEBUG_FUNCTION
2034 "libxslt:test() called with %d args\n", nargs);
2035#endif
2036}
2037
2045static xsltElemPreCompPtr
2047 xsltTransformFunction function)
2048{
2050
2051 if (style == NULL) {
2053 "xsltExtElementTest: no transformation context\n");
2054 return (NULL);
2055 }
2056 if (testStyleData == NULL) {
2058 "xsltExtElementPreCompTest: not initialized,"
2059 " calling xsltStyleGetExtData\n");
2061 if (testStyleData == NULL) {
2063 "xsltExtElementPreCompTest: not initialized\n");
2064 if (style != NULL)
2065 style->errors++;
2066 return (NULL);
2067 }
2068 }
2069 if (inst == NULL) {
2071 "xsltExtElementPreCompTest: no instruction\n");
2072 if (style != NULL)
2073 style->errors++;
2074 return (NULL);
2075 }
2076 ret = xsltNewElemPreComp(style, inst, function);
2077 return (ret);
2078}
2079
2089static void
2091 xmlNodePtr inst,
2093{
2094 xmlNodePtr commentNode;
2095
2096 if (testData == NULL) {
2098 "xsltExtElementTest: not initialized,"
2099 " calling xsltGetExtData\n");
2100 xsltGetExtData(ctxt, (const xmlChar *) XSLT_DEFAULT_URL);
2101 if (testData == NULL) {
2102 xsltTransformError(ctxt, NULL, inst,
2103 "xsltExtElementTest: not initialized\n");
2104 return;
2105 }
2106 }
2107 if (ctxt == NULL) {
2108 xsltTransformError(ctxt, NULL, inst,
2109 "xsltExtElementTest: no transformation context\n");
2110 return;
2111 }
2112 if (node == NULL) {
2113 xsltTransformError(ctxt, NULL, inst,
2114 "xsltExtElementTest: no current node\n");
2115 return;
2116 }
2117 if (inst == NULL) {
2118 xsltTransformError(ctxt, NULL, inst,
2119 "xsltExtElementTest: no instruction\n");
2120 return;
2121 }
2122 if (ctxt->insert == NULL) {
2123 xsltTransformError(ctxt, NULL, inst,
2124 "xsltExtElementTest: no insertion point\n");
2125 return;
2126 }
2127 commentNode = xmlNewComment((const xmlChar *)
2128 "libxslt:test element test worked");
2129 xmlAddChild(ctxt->insert, commentNode);
2130}
2131
2141static void *
2143{
2144 if (testStyleData == NULL) {
2146 "xsltExtInitTest: not initialized,"
2147 " calling xsltStyleGetExtData\n");
2149 if (testStyleData == NULL) {
2151 "xsltExtInitTest: not initialized\n");
2152 return (NULL);
2153 }
2154 }
2155 if (testData != NULL) {
2157 "xsltExtInitTest: already initialized\n");
2158 return (NULL);
2159 }
2160 testData = (void *) "test data";
2162 "Registered test module : %s\n", URI);
2163 return (testData);
2164}
2165
2166
2175static void
2177 const xmlChar * URI, void *data)
2178{
2179 if (testData == NULL) {
2181 "xsltExtShutdownTest: not initialized\n");
2182 return;
2183 }
2184 if (data != testData) {
2186 "xsltExtShutdownTest: wrong data\n");
2187 }
2188 testData = NULL;
2190 "Unregistered test module : %s\n", URI);
2191}
2192
2202static void *
2204 const xmlChar * URI)
2205{
2206 if (testStyleData != NULL) {
2208 "xsltExtInitTest: already initialized\n");
2209 return (NULL);
2210 }
2211 testStyleData = (void *) "test data";
2213 "Registered test module : %s\n", URI);
2214 return (testStyleData);
2215}
2216
2217
2226static void
2228 const xmlChar * URI, void *data)
2229{
2230 if (testStyleData == NULL) {
2232 "xsltExtShutdownTest: not initialized\n");
2233 return;
2234 }
2235 if (data != testStyleData) {
2237 "xsltExtShutdownTest: wrong data\n");
2238 }
2241 "Unregistered test module : %s\n", URI);
2242}
2243
2249void
2251{
2257 xsltRegisterExtModuleFunction((const xmlChar *) "test",
2258 (const xmlChar *) XSLT_DEFAULT_URL,
2260 xsltRegisterExtModuleElement((const xmlChar *) "test",
2261 (const xmlChar *) XSLT_DEFAULT_URL,
2264}
2265
2266static void
2268 void *data ATTRIBUTE_UNUSED,
2270{
2271#ifdef WITH_MODULES
2272 xmlModuleClose(payload);
2273#endif
2274}
2275
2281void
2283{
2284 if (xsltExtMutex == NULL) {
2286 }
2287}
2288
2294void
2296{
2301
2303 /* cleanup dynamic module hash */
2304 if (NULL != xsltModuleHash) {
2308 }
2310
2314 xsltUninit();
2315}
2316
2317static void
2319 void *data, const xmlChar * name,
2320 const xmlChar * URI,
2321 const xmlChar * not_used ATTRIBUTE_UNUSED)
2322{
2323 FILE *output = (FILE *) data;
2324 if (!name || !URI)
2325 return;
2326 fprintf(output, "{%s}%s\n", URI, name);
2327}
2328
2329static void
2331 void *data, const xmlChar * URI,
2332 const xmlChar * not_used ATTRIBUTE_UNUSED,
2333 const xmlChar * not_used2 ATTRIBUTE_UNUSED)
2334{
2335 FILE *output = (FILE *) data;
2336 if (!URI)
2337 return;
2338 fprintf(output, "%s\n", URI);
2339}
2340
2347void
2349{
2350 if (output == NULL)
2351 output = stdout;
2352 fprintf(output,
2353 "Registered XSLT Extensions\n--------------------------\n");
2355 if (!xsltFunctionsHash) {
2356 fprintf(output, "No registered extension functions\n");
2357 } else {
2358 fprintf(output, "Registered extension functions:\n");
2360 output);
2361 }
2362 if (!xsltTopLevelsHash) {
2363 fprintf(output, "\nNo registered top-level extension elements\n");
2364 } else {
2365 fprintf(output, "\nRegistered top-level extension elements:\n");
2367 output);
2368 }
2369 if (!xsltElementsHash) {
2370 fprintf(output, "\nNo registered instruction extension elements\n");
2371 } else {
2372 fprintf(output, "\nRegistered instruction extension elements:\n");
2374 output);
2375 }
2376 if (!xsltExtensionsHash) {
2377 fprintf(output, "\nNo registered extension modules\n");
2378 } else {
2379 fprintf(output, "\nRegistered extension modules:\n");
2381 output);
2382 }
2384}
int xsltUnregisterExtModuleElement(const xmlChar *name, const xmlChar *URI)
Definition: extensions.c:1806
int xsltUnregisterExtModule(const xmlChar *URI)
Definition: extensions.c:1342
int xsltCheckExtURI(xsltStylesheetPtr style, const xmlChar *URI)
Definition: extensions.c:1243
static xmlChar * testData
Definition: extensions.c:1985
static void xsltExtStyleShutdownTest(xsltStylesheetPtr style ATTRIBUTE_UNUSED, const xmlChar *URI, void *data)
Definition: extensions.c:2227
int xsltUnregisterExtModuleFunction(const xmlChar *name, const xmlChar *URI)
Definition: extensions.c:1479
int xsltRegisterExtFunction(xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *URI, xmlXPathFunction function)
Definition: extensions.c:609
static xmlHashTablePtr xsltModuleHash
Definition: extensions.c:91
int xsltInitCtxtExts(xsltTransformContextPtr ctxt)
Definition: extensions.c:1041
static void xsltShutdownExt(void *payload, void *vctxt, const xmlChar *URI)
Definition: extensions.c:1126
int xsltCheckExtPrefix(xsltStylesheetPtr style, const xmlChar *URI)
Definition: extensions.c:1183
static xmlMutexPtr xsltExtMutex
Definition: extensions.c:92
static void xsltExtFunctionTest(xmlXPathParserContextPtr ctxt, int nargs ATTRIBUTE_UNUSED)
Definition: extensions.c:1996
void xsltDebugDumpExtensions(FILE *output)
Definition: extensions.c:2348
static xsltExtModulePtr xsltNewExtModule(xsltExtInitFunction initFunc, xsltExtShutdownFunction shutdownFunc, xsltStyleExtInitFunction styleInitFunc, xsltStyleExtShutdownFunction styleShutdownFunc)
Definition: extensions.c:176
int xsltRegisterExtElement(xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *URI, xsltTransformFunction function)
Definition: extensions.c:643
xsltPreComputeFunction xsltExtModuleElementPreComputeLookup(const xmlChar *name, const xmlChar *URI)
Definition: extensions.c:1766
static void xsltFreeExtModuleEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: extensions.c:211
static xsltExtElementPtr xsltNewExtElement(xsltPreComputeFunction precomp, xsltTransformFunction transform)
Definition: extensions.c:272
static int xsltExtModuleRegisterDynamic(const xmlChar *URI ATTRIBUTE_UNUSED)
Definition: extensions.c:481
static xsltExtDataPtr xsltStyleInitializeStylesheetModule(xsltStylesheetPtr style, const xmlChar *URI)
Definition: extensions.c:685
void * xsltGetExtData(xsltTransformContextPtr ctxt, const xmlChar *URI)
Definition: extensions.c:883
static void * xsltExtInitTest(xsltTransformContextPtr ctxt, const xmlChar *URI)
Definition: extensions.c:2142
static void xsltUnregisterAllExtModuleElement(void)
Definition: extensions.c:1829
int xsltRegisterExtModuleFull(const xmlChar *URI, xsltExtInitFunction initFunc, xsltExtShutdownFunction shutdownFunc, xsltStyleExtInitFunction styleInitFunc, xsltStyleExtShutdownFunction styleShutdownFunc)
Definition: extensions.c:1273
static void * xsltExtStyleInitTest(xsltStylesheetPtr style ATTRIBUTE_UNUSED, const xmlChar *URI)
Definition: extensions.c:2203
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:2330
static xmlHashTablePtr xsltTopLevelsHash
Definition: extensions.c:90
static void xsltFreeExtData(xsltExtDataPtr ext)
Definition: extensions.c:249
int xsltRegisterExtModuleTopLevel(const xmlChar *name, const xmlChar *URI, xsltTopLevelFunction function)
Definition: extensions.c:1850
void xsltRegisterTestModule(void)
Definition: extensions.c:2250
static xmlChar * testStyleData
Definition: extensions.c:1986
static void xsltUnregisterAllExtModules(void)
Definition: extensions.c:1366
int xsltRegisterExtModule(const xmlChar *URI, xsltExtInitFunction initFunc, xsltExtShutdownFunction shutdownFunc)
Definition: extensions.c:1325
void xsltFreeCtxtExts(xsltTransformContextPtr ctxt)
Definition: extensions.c:664
static void xsltUnregisterAllExtModuleFunction(void)
Definition: extensions.c:1501
xsltExtModule * xsltExtModulePtr
Definition: extensions.c:65
static void xsltFreeExtDefList(xsltExtDefPtr extensiond)
Definition: extensions.c:153
static void xsltFreeElemPreComp(xsltElemPreCompPtr comp)
Definition: extensions.c:1513
static xsltExtDataPtr xsltNewExtData(xsltExtModulePtr extModule, void *extData)
Definition: extensions.c:225
xsltTransformFunction xsltExtModuleElementLookup(const xmlChar *name, const xmlChar *URI)
Definition: extensions.c:1723
xsltElemPreCompPtr xsltPreComputeExtModuleElement(xsltStylesheetPtr style, xmlNodePtr inst)
Definition: extensions.c:1583
static xsltExtDefPtr xsltNewExtDef(const xmlChar *prefix, const xmlChar *URI)
Definition: extensions.c:110
xsltExtElement * xsltExtElementPtr
Definition: extensions.c:81
xsltTransformContextPtr xsltXPathGetTransformContext(xmlXPathParserContextPtr ctxt)
Definition: extensions.c:1392
void xsltShutdownExts(xsltStylesheetPtr style)
Definition: extensions.c:1158
static void xsltShutdownCtxtExt(void *payload, void *vctxt, const xmlChar *URI)
Definition: extensions.c:1080
xsltExtData * xsltExtDataPtr
Definition: extensions.c:74
static void xsltFreeExtDef(xsltExtDefPtr extensiond)
Definition: extensions.c:135
xsltElemPreCompPtr xsltNewElemPreComp(xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function)
Definition: extensions.c:1528
static void xsltFreeExtDataEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: extensions.c:257
static xmlHashTablePtr xsltFunctionsHash
Definition: extensions.c:88
void xsltInitElemPreComp(xsltElemPreCompPtr comp, xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function, xsltElemPreCompDeallocator freeFunc)
Definition: extensions.c:1560
int xsltRegisterExtModuleElement(const xmlChar *name, const xmlChar *URI, xsltPreComputeFunction precomp, xsltTransformFunction transform)
Definition: extensions.c:1648
static void xsltUnregisterAllExtModuleTopLevel(void)
Definition: extensions.c:1940
static void xsltHashScannerModuleFree(void *payload ATTRIBUTE_UNUSED, void *data ATTRIBUTE_UNUSED, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: extensions.c:2267
xmlXPathFunction xsltExtModuleFunctionLookup(const xmlChar *name, const xmlChar *URI)
Definition: extensions.c:1441
xsltTransformFunction xsltExtElementLookup(xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *URI)
Definition: extensions.c:1693
static xsltElemPreCompPtr xsltExtElementPreCompTest(xsltStylesheetPtr style, xmlNodePtr inst, xsltTransformFunction function)
Definition: extensions.c:2046
static void xsltInitCtxtExt(void *payload, void *data, const xmlChar *URI)
Definition: extensions.c:957
static xmlHashTablePtr xsltElementsHash
Definition: extensions.c:89
void xsltCleanupGlobals(void)
Definition: extensions.c:2295
static void xsltFreeExtElement(xsltExtElementPtr ext)
Definition: extensions.c:298
static void xsltExtElementTest(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr comp ATTRIBUTE_UNUSED)
Definition: extensions.c:2090
static void xsltFreeExtModule(xsltExtModulePtr ext)
Definition: extensions.c:203
static void xsltExtShutdownTest(xsltTransformContextPtr ctxt, const xmlChar *URI, void *data)
Definition: extensions.c:2176
void xsltInitGlobals(void)
Definition: extensions.c:2282
static xmlHashTablePtr xsltExtensionsHash
Definition: extensions.c:87
static void xsltFreeExtElementEntry(void *payload, const xmlChar *name ATTRIBUTE_UNUSED)
Definition: extensions.c:306
xmlHashTablePtr xsltGetExtInfo(xsltStylesheetPtr style, const xmlChar *URI)
Definition: extensions.c:1960
static void xsltDebugDumpExtensionsCallback(void *function ATTRIBUTE_UNUSED, void *data, const xmlChar *name, const xmlChar *URI, const xmlChar *not_used ATTRIBUTE_UNUSED)
Definition: extensions.c:2318
void xsltShutdownCtxtExts(xsltTransformContextPtr ctxt)
Definition: extensions.c:1106
xsltExtDef * xsltExtDefPtr
Definition: extensions.c:56
int xsltRegisterExtModuleFunction(const xmlChar *name, const xmlChar *URI, xmlXPathFunction function)
Definition: extensions.c:1410
void * xsltStyleGetExtData(xsltStylesheetPtr style, const xmlChar *URI)
Definition: extensions.c:781
void xsltFreeExts(xsltStylesheetPtr style)
Definition: extensions.c:501
int xsltRegisterExtPrefix(xsltStylesheetPtr style, const xmlChar *prefix, const xmlChar *URI)
Definition: extensions.c:525
int xsltUnregisterExtModuleTopLevel(const xmlChar *name, const xmlChar *URI)
Definition: extensions.c:1918
xsltTopLevelFunction xsltExtModuleTopLevelLookup(const xmlChar *name, const xmlChar *URI)
Definition: extensions.c:1881
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
char *CDECL getenv(const char *name)
Definition: environ.c:227
int WINAPIV fprintf(FILE *file, const char *format,...)
Definition: file.c:5549
#define stdout
return ret
Definition: mutex.c:146
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:297
XMLPUBFUN void xmlMutexLock(xmlMutexPtr tok)
Definition: threads.c:201
XMLPUBFUN void xmlFreeMutex(xmlMutexPtr tok)
Definition: threads.c:185
XMLPUBFUN void xmlMutexUnlock(xmlMutexPtr tok)
Definition: threads.c:225
XMLPUBFUN xmlMutexPtr xmlNewMutex(void)
Definition: threads.c:149
if(dx< 0)
Definition: linetemp.h:194
xmlFreeFunc xmlFree
Definition: globals.c:184
xmlMallocFunc xmlMalloc
Definition: globals.c:193
void xmlHashScan(xmlHashTablePtr hash, xmlHashScanner scan, void *data)
Definition: hash.c:898
void xmlHashFree(xmlHashTablePtr hash, xmlHashDeallocator dealloc)
Definition: hash.c:229
void * xmlHashLookup(xmlHashTablePtr hash, const xmlChar *key)
Definition: hash.c:739
void * xmlHashLookup2(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2)
Definition: hash.c:754
int xmlHashRemoveEntry(xmlHashTablePtr hash, const xmlChar *key, xmlHashDeallocator dealloc)
Definition: hash.c:1102
int xmlHashRemoveEntry2(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2, xmlHashDeallocator dealloc)
Definition: hash.c:1121
int xmlHashAddEntry(xmlHashTablePtr hash, const xmlChar *key, void *payload)
Definition: hash.c:621
xmlHashTablePtr xmlHashCreate(int size)
Definition: hash.c:160
void xmlHashScanFull(xmlHashTablePtr hash, xmlHashScannerFull scan, void *data)
Definition: hash.c:914
int xmlHashUpdateEntry2(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2, void *payload, xmlHashDeallocator dealloc)
Definition: hash.c:699
int xmlHashAddEntry2(xmlHashTablePtr hash, const xmlChar *key, const xmlChar *key2, void *payload)
Definition: hash.c:639
#define memset(x, y, z)
Definition: compat.h:39
xsltElemPreCompDeallocator free
xsltElemPreCompPtr next
xsltStyleType type
xsltTransformFunction func
void * extData
Definition: extensions.c:77
xsltExtModulePtr extModule
Definition: extensions.c:76
xmlChar * URI
Definition: extensions.c:60
struct _xsltExtDef * next
Definition: extensions.c:58
void * data
Definition: extensions.c:61
xmlChar * prefix
Definition: extensions.c:59
xsltPreComputeFunction precomp
Definition: extensions.c:83
xsltTransformFunction transform
Definition: extensions.c:84
xsltExtInitFunction initFunc
Definition: extensions.c:67
xsltExtShutdownFunction shutdownFunc
Definition: extensions.c:68
xsltStyleExtInitFunction styleInitFunc
Definition: extensions.c:69
xsltStyleExtShutdownFunction styleShutdownFunc
Definition: extensions.c:70
xsltTransformContextPtr ctxt
Definition: extensions.c:944
struct _xsltStylesheet * parent
xmlHashTablePtr extInfos
xmlHashTablePtr extElements
xmlHashTablePtr extFunctions
xmlHashTablePtr extInfos
xsltStylesheetPtr style
xmlXPathContextPtr xpathCtxt
Definition: fs.h:78
Definition: name.c:39
Character const *const prefix
Definition: tempnam.cpp:195
Definition: dlist.c:348
XMLPUBFUN int xmlCheckFilename(const char *path)
XMLPUBFUN int xmlStrPrintf(xmlChar *buf, int len, const char *msg,...) LIBXML_ATTR_FORMAT(3
XMLPUBFUN const xmlChar * xmlStrstr(const xmlChar *str, const xmlChar *val)
Definition: xmlstring.c:347
XMLPUBFUN xmlChar * xmlStrcat(xmlChar *cur, const xmlChar *add)
Definition: xmlstring.c:524
#define BAD_CAST
Definition: xmlstring.h:35
XMLPUBFUN int xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:162
unsigned char xmlChar
Definition: xmlstring.h:28
XMLPUBFUN xmlChar * xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:69
xsltTransformContext * xsltTransformContextPtr
@ XSLT_FUNC_EXTENSION
xsltElemPreComp * xsltElemPreCompPtr
#define XML_CAST_FPTR(fptr)
xsltStylesheet * xsltStylesheetPtr
void(* xsltElemPreCompDeallocator)(xsltElemPreCompPtr comp)
void(* xsltTransformFunction)(xsltTransformContextPtr ctxt, xmlNodePtr node, xmlNodePtr inst, xsltElemPreCompPtr comp)
void xsltUninit(void)
Definition: xslt.c:232
#define XSLT_DEFAULT_URL
Definition: xslt.h:39
void xsltFreeLocales(void)
Definition: xsltlocale.c:93
void xsltTransformError(xsltTransformContextPtr ctxt, xsltStylesheetPtr style, xmlNodePtr node, const char *msg,...)
Definition: xsltutils.c:762
xmlGenericErrorFunc xsltGenericError
Definition: xsltutils.c:586
xmlGenericErrorFunc xsltGenericDebug
Definition: xsltutils.c:632
void * xsltGenericDebugContext
Definition: xsltutils.c:633
void * xsltGenericErrorContext
Definition: xsltutils.c:587