mirror of
https://github.com/darlinghq/darling-libxslt.git
synced 2024-12-03 09:30:49 +00:00
Applied another patch from Joel Reed, fixed a segfault and changed the
* tests/plugins/plugin.* tests/Makefile.am libxslt/extensions.c libxslt/Makefile.am configure.in: Applied another patch from Joel Reed, fixed a segfault and changed the configure code a bit to work in my debug environment. Daniel
This commit is contained in:
parent
b362c75108
commit
49d30890fb
@ -1,3 +1,10 @@
|
||||
Sat Jan 15 13:54:28 CET 2005 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* tests/plugins/plugin.* tests/Makefile.am libxslt/extensions.c
|
||||
libxslt/Makefile.am configure.in: Applied another patch from
|
||||
Joel Reed, fixed a segfault and changed the configure code
|
||||
a bit to work in my debug environment.
|
||||
|
||||
Tue Jan 11 10:50:33 HKT 2005 William Brack <wbrack@mmm.com.hk>
|
||||
|
||||
* configure.in: added python2.4 to the list of accepted
|
||||
|
@ -22,6 +22,7 @@ LIBXSLT_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION.$LIBXSLT_MICRO_VER
|
||||
LIBXSLT_VERSION_INFO=`expr $LIBXSLT_MAJOR_VERSION + $LIBXSLT_MINOR_VERSION`:$LIBXSLT_MICRO_VERSION:$LIBXSLT_MINOR_VERSION
|
||||
|
||||
LIBXSLT_VERSION_NUMBER=`expr $LIBXSLT_MAJOR_VERSION \* 10000 + $LIBXSLT_MINOR_VERSION \* 100 + $LIBXSLT_MICRO_VERSION`
|
||||
LIBXSLT_MAJOR_MINOR_VERSION=$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION
|
||||
|
||||
if test -f CVS/Entries; then
|
||||
extra=`grep ChangeLog CVS/Entries | grep -v LIBXSLT | sed -e s\%/ChangeLog/1\.%% -e s\%/.*$%%`
|
||||
@ -39,6 +40,7 @@ AC_SUBST(LIBXSLT_VERSION)
|
||||
AC_SUBST(LIBXSLT_VERSION_INFO)
|
||||
AC_SUBST(LIBXSLT_VERSION_NUMBER)
|
||||
AC_SUBST(LIBXSLT_VERSION_EXTRA)
|
||||
AC_SUBST(LIBXSLT_MAJOR_MINOR_VERSION)
|
||||
|
||||
dnl
|
||||
dnl libexslt is an extension library
|
||||
@ -283,6 +285,7 @@ if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XSLT" ]] || \
|
||||
if test "$LOGNAME" = "veillard"
|
||||
then
|
||||
LIBXML_SRC="/u/veillard/XML"
|
||||
EXTRA_LIBS="$EXTRA_LIBS -ldl"
|
||||
fi
|
||||
else
|
||||
STATIC_BINARIES=
|
||||
@ -456,13 +459,14 @@ else
|
||||
fi
|
||||
|
||||
AC_SUBST(WITH_MODULES)
|
||||
AM_CONDITIONAL(WITH_MODULES, test "$WITH_MODULES" == "1")
|
||||
|
||||
dnl
|
||||
dnl setup default module path
|
||||
dnl
|
||||
module_prefix=$prefix
|
||||
test "x$module_prefix" = xNONE && module_prefix=$ac_default_prefix
|
||||
LIBXSLT_DEFAULT_PLUGINS_PATH="\"$module_prefix/lib/libxslt/$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION/\""
|
||||
LIBXSLT_DEFAULT_PLUGINS_PATH="\"$module_prefix/lib/libxslt/$LIBXSLT_MAJOR_VERSION.$LIBXSLT_MINOR_VERSION\""
|
||||
AC_SUBST(LIBXSLT_DEFAULT_PLUGINS_PATH)
|
||||
|
||||
dnl
|
||||
@ -518,7 +522,7 @@ AC_SUBST(EXSLT_LIBDIR)
|
||||
AC_SUBST(EXSLT_INCLUDEDIR)
|
||||
AC_SUBST(EXSLT_LIBS)
|
||||
|
||||
EXTRA_LIBS="$LIBXML_LIBS $M_LIBS"
|
||||
EXTRA_LIBS="$EXTRA_LIBS $LIBXML_LIBS $M_LIBS"
|
||||
AC_SUBST(EXTRA_LIBS)
|
||||
|
||||
AC_SUBST(M_LIBS)
|
||||
|
@ -57,5 +57,21 @@ man_MANS = libxslt.3
|
||||
|
||||
EXTRA_DIST = $(man_MANS) trio.h triodef.h
|
||||
|
||||
|
||||
# somewhat unconventional pkglibdir, but noinst_LTLIBRARIES
|
||||
# never build DSOs (afaik). NOTE: must be defined outside the AM_CONDITIONAL
|
||||
pkglibdir=$(shell pwd)/../tests/plugins
|
||||
|
||||
if WITH_MODULES
|
||||
pkglib_LTLIBRARIES = xmlsoft_org_xslt_testplugin.la
|
||||
|
||||
xmlsoft_org_xslt_testplugin_la_CFLAGS = -DMODULE_COMPILE $(LIBXML_CFLAGS) $(LIBXSLT_CFLAGS)
|
||||
xmlsoft_org_xslt_testplugin_la_SOURCES = testplugin.c
|
||||
xmlsoft_org_xslt_testplugin_la_LDFLAGS = -module -avoid-version $(LIBXML_LIBS) $(LIBXSLT_LIBS)
|
||||
|
||||
check-local: install-pkglibLTLIBRARIES
|
||||
|
||||
endif
|
||||
|
||||
xsltproc: all
|
||||
@(cd ../xsltproc ; $(MAKE))
|
||||
|
@ -298,8 +298,17 @@ typedef void (*exsltRegisterFunction) (void);
|
||||
* xsltExtModuleRegisterDynamic:
|
||||
* @URI: the function or element namespace URI
|
||||
*
|
||||
* Looks up an extension module to dynamically load
|
||||
* based on the namespace URI
|
||||
* Dynamically loads an extension plugin when available.
|
||||
*
|
||||
* The plugin name is derived from the URI by removing the
|
||||
* initial protocol designation, e.g. "http://", then converting
|
||||
* the characters ".", "-", "/", and "\" into "_", the removing
|
||||
* any trailing "/", then concatenating LIBXML_MODULE_EXTENSION.
|
||||
*
|
||||
* Plugins are loaded from the directory specified by the
|
||||
* environment variable LIBXSLT_PLUGINS_PATH, or if NULL,
|
||||
* by LIBXSLT_DEFAULT_PLUGINS_PATH() which is determined at
|
||||
* compile time.
|
||||
*
|
||||
* Returns 0 if successful, -1 in case of error.
|
||||
*/
|
||||
@ -310,10 +319,12 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI)
|
||||
|
||||
xmlModulePtr m;
|
||||
exsltRegisterFunction regfunc;
|
||||
xmlChar *ext_name;
|
||||
xmlChar module_filename[PATH_MAX];
|
||||
const xmlChar *extNameBegin = NULL;
|
||||
const xmlChar *extDirectory = NULL;
|
||||
int i, rc, seen_before;
|
||||
const xmlChar *ext_directory = NULL;
|
||||
const xmlChar *protocol = NULL;
|
||||
xmlChar *i, *regfunc_name;
|
||||
int rc, seen_before;
|
||||
|
||||
/* check for bad inputs */
|
||||
if (URI == NULL)
|
||||
@ -331,43 +342,75 @@ xsltExtModuleRegisterDynamic(const xmlChar * URI)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
for (i = xmlStrlen(URI); i != 0 && extNameBegin == NULL; --i) {
|
||||
if (URI[i - 1] == '/')
|
||||
extNameBegin = URI + i;
|
||||
/* transform extension namespace into a module name */
|
||||
protocol = xmlStrstr(URI, "://");
|
||||
if (protocol == NULL) {
|
||||
ext_name = xmlStrdup(URI);
|
||||
} else {
|
||||
ext_name = xmlStrdup(protocol + 3);
|
||||
}
|
||||
if (ext_name == NULL) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (extNameBegin == NULL || *extNameBegin == '\0')
|
||||
return (-1);
|
||||
i = ext_name;
|
||||
while ('\0' != *i) {
|
||||
if (('/' == *i) || ('\\' == *i) || ('.' == *i) || ('-' == *i))
|
||||
*i = '_';
|
||||
i++;
|
||||
}
|
||||
|
||||
if (*(i - 1) == '_')
|
||||
*i = '\0';
|
||||
|
||||
/* determine module directory */
|
||||
extDirectory = getenv(BAD_CAST "LIBXSLT_PLUGINS_PATH");
|
||||
if (NULL == extDirectory)
|
||||
extDirectory = LIBXSLT_DEFAULT_PLUGINS_PATH();
|
||||
if (NULL == extDirectory)
|
||||
ext_directory = getenv(BAD_CAST "LIBXSLT_PLUGINS_PATH");
|
||||
if (NULL == ext_directory)
|
||||
ext_directory = LIBXSLT_DEFAULT_PLUGINS_PATH();
|
||||
if (NULL == ext_directory)
|
||||
return (-1);
|
||||
|
||||
/* build the module filename, and confirm the module exists */
|
||||
xmlStrPrintf(module_filename, sizeof(module_filename), "%s%s%s",
|
||||
extDirectory, extNameBegin, LIBXML_MODULE_EXTENSION);
|
||||
if (1 != xmlCheckFilename(module_filename))
|
||||
xmlStrPrintf(module_filename, sizeof(module_filename), "%s/%s%s",
|
||||
ext_directory, ext_name, LIBXML_MODULE_EXTENSION);
|
||||
if (1 != xmlCheckFilename(module_filename)) {
|
||||
xmlFree(ext_name);
|
||||
return (-1);
|
||||
|
||||
m = xmlModuleOpen(module_filename, 0);
|
||||
if (NULL == m)
|
||||
return (-1);
|
||||
|
||||
rc = xmlModuleSymbol(m, "exsltRegisterModule", (void **) ®func);
|
||||
if (0 == rc) {
|
||||
(*regfunc) ();
|
||||
}
|
||||
|
||||
/* register this module in our hash */
|
||||
xmlHashAddEntry(xsltModuleHash, URI, (void *) m);
|
||||
/* attempt to open the module */
|
||||
m = xmlModuleOpen(module_filename, 0);
|
||||
if (NULL == m) {
|
||||
xmlFree(ext_name);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* construct initialization func name */
|
||||
regfunc_name = xmlStrdup(ext_name);
|
||||
regfunc_name = xmlStrcat(regfunc_name, "_init");
|
||||
|
||||
rc = xmlModuleSymbol(m, regfunc_name, (void **) ®func);
|
||||
if (0 == rc) {
|
||||
/* call the module's init function */
|
||||
(*regfunc) ();
|
||||
|
||||
/* register this module in our hash */
|
||||
xmlHashAddEntry(xsltModuleHash, URI, (void *) m);
|
||||
} else {
|
||||
/* if regfunc not found unload the module immediately */
|
||||
xmlModuleClose(m);
|
||||
}
|
||||
|
||||
xmlFree(ext_name);
|
||||
xmlFree(regfunc_name);
|
||||
return (NULL == regfunc) ? -1 : 0;
|
||||
}
|
||||
#else
|
||||
#define xsltExtModuleRegisterDynamic(b) -1
|
||||
static int
|
||||
xsltExtModuleRegisterDynamic(const xmlChar * ATTRIBUTE_UNUSED URI)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************
|
||||
|
@ -44,7 +44,7 @@ extern "C" {
|
||||
*
|
||||
* extra version information, used to show a CVS compilation
|
||||
*/
|
||||
#define LIBXML_VERSION_EXTRA "-CVS978"
|
||||
#define LIBXML_VERSION_EXTRA "-CVS980"
|
||||
|
||||
/**
|
||||
* WITH_XSLT_DEBUG:
|
||||
|
@ -12,6 +12,7 @@ all:
|
||||
# and (if errors are expected) in *.err
|
||||
test tests:
|
||||
@(cur=`pwd` ; for dir in $(SUBDIRS) ; do cd $$dir ; $(MAKE) CHECKER='$(CHECKER)' tests ; cd $$cur ; done)
|
||||
$(MAKE) plugin_tests
|
||||
|
||||
valgrind:
|
||||
@echo '## Running the regression tests under Valgrind'
|
||||
@ -23,3 +24,15 @@ full: tests docbook_tests
|
||||
docbook_tests:
|
||||
@(cd docbook ; $(MAKE) full)
|
||||
|
||||
if WITH_MODULES
|
||||
|
||||
plugin_tests:
|
||||
@echo Running the plugin tests...
|
||||
@(cd plugins && LIBXSLT_PLUGINS_PATH=. $(top_builddir)/../xsltproc/xsltproc plugin.xsl plugin.xml)
|
||||
|
||||
else
|
||||
|
||||
plugin_tests:
|
||||
@echo Skipping the plugin tests.
|
||||
|
||||
endif
|
||||
|
3
tests/plugins/plugin.out
Normal file
3
tests/plugins/plugin.out
Normal file
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--libxslt:testplugin element test worked-->
|
||||
SUCCESS
|
1
tests/plugins/plugin.xml
Normal file
1
tests/plugins/plugin.xml
Normal file
@ -0,0 +1 @@
|
||||
<doc/>
|
12
tests/plugins/plugin.xsl
Normal file
12
tests/plugins/plugin.xsl
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version='1.0'?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:libxslt="http://xmlsoft.org/xslt/testplugin"
|
||||
xmlns:test="http://xmlsoft.org/xslt/testplugin"
|
||||
xsl:extension-element-prefixes="libxslt test"
|
||||
version='1.0'>
|
||||
<!-- the prefix is registered twice to check single initialization -->
|
||||
<xsl:template match="/">
|
||||
<libxslt:testplugin/>
|
||||
<xsl:value-of select="libxslt:testplugin('SUCCESS')"/>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
Loading…
Reference in New Issue
Block a user