From: Melvyn Sopacua Date: Sun, 10 Nov 2002 12:18:03 +0000 (+0000) Subject: - implement xslt_backend_info X-Git-Tag: php-4.3.0RC1~151 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d3da22fb95b8a6d4b53df52f9edc5e822f4b3715;p=php - implement xslt_backend_info - add test for it - fix some prototypes --- diff --git a/ext/xslt/config.m4 b/ext/xslt/config.m4 index 9d69355f3a..d721721764 100644 --- a/ext/xslt/config.m4 +++ b/ext/xslt/config.m4 @@ -58,6 +58,19 @@ if test "$PHP_XSLT" != "no"; then fi if test "$PHP_XSLT_SABLOT" != "no"; then + AC_MSG_CHECKING([for sablot-config]) + if test -x $XSLT_DIR/bin/sablot-config ; then + AC_MSG_RESULT(found) + AC_DEFINE(HAVE_SABLOT_CONFIG, 1, [Whether the Sablotron config file is found]) + dnl Use this script to register this information in phpinfo() + SABINF_CFLAGS=`$XSLT_DIR/bin/sablot-config --cflags` + SABINF_LIBS=`$XSLT_DIR/bin/sablot-config --libs` + SABINF_PREFIX=`$XSLT_DIR/bin/sablot-config --prefix` + SABINF_ALL="\"Cflags: $SABINF_CFLAGS\nLibs: $SABINF_LIBS\nPrefix: $SABINF_PREFIX\"" + PHP_DEFINE(SAB_INFO, "$SABINF_ALL") + else + AC_MSG_RESULT(not found) + fi AC_MSG_CHECKING([for Sablotron version]) old_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I$XSLT_DIR/include" diff --git a/ext/xslt/php_sablot.h b/ext/xslt/php_sablot.h index c35c9e001e..6205193715 100644 --- a/ext/xslt/php_sablot.h +++ b/ext/xslt/php_sablot.h @@ -50,6 +50,7 @@ extern zend_module_entry xslt_module_entry; #define XSLT_FUNCH_FREE(__var) if (__var) zval_ptr_dtor(&(__var)); #define XSLT_REG_ERRMSG(msg, handle) if (XSLT_ERRSTR(handle)) efree(XSLT_ERRSTR(handle)); \ XSLT_ERRSTR(handle) = estrdup(msg); +#define XSLT_NO_INFO "No information available." PHP_MINIT_FUNCTION(xslt); PHP_MINFO_FUNCTION(xslt); @@ -72,7 +73,7 @@ PHP_FUNCTION(xslt_getopt); #endif PHP_FUNCTION(xslt_backend_version); PHP_FUNCTION(xslt_backend_name); - +PHP_FUNCTION(xslt_backend_info); struct scheme_handlers { zval *sh_get_all; diff --git a/ext/xslt/sablot.c b/ext/xslt/sablot.c index b8de408f95..f55003757e 100644 --- a/ext/xslt/sablot.c +++ b/ext/xslt/sablot.c @@ -32,6 +32,9 @@ #if HAVE_SABLOT_BACKEND +#ifdef HAVE_SABLOT_CONFIG +#include "php_sab_info.h" +#endif #include #include @@ -99,6 +102,7 @@ function_entry xslt_functions[] = { #endif PHP_FE(xslt_backend_version, NULL) PHP_FE(xslt_backend_name, NULL) + PHP_FE(xslt_backend_info, NULL) {NULL, NULL, NULL} }; /* }}} */ @@ -192,6 +196,9 @@ PHP_MINFO_FUNCTION(xslt) php_info_print_table_row(2, "Backend", "Sablotron"); #ifdef SAB_VERSION php_info_print_table_row(2, "Sablotron Version", SAB_VERSION); +#endif +#ifdef HAVE_SABLOT_CONFIG + php_info_print_table_row(2, "Sablotron Information", SAB_INFO); #endif php_info_print_table_end(); } @@ -758,7 +765,7 @@ PHP_FUNCTION(xslt_getopt) /* }}} */ #endif -/* {{{ proto void xslt_backend_version() +/* {{{ proto string xslt_backend_version() Returns the version number of Sablotron (if available) */ PHP_FUNCTION(xslt_backend_version) { @@ -770,7 +777,7 @@ PHP_FUNCTION(xslt_backend_version) } /* }}} */ -/* {{{ proto void xslt_backend_name() +/* {{{ proto string xslt_backend_name() Returns the name of the Backend (here "Sablotron")*/ PHP_FUNCTION(xslt_backend_name) { @@ -778,6 +785,17 @@ PHP_FUNCTION(xslt_backend_name) } /* }}} */ +/* {{{ proto string xslt_backend_info() + Returns the information on the compilation settings of the backend */ +PHP_FUNCTION(xslt_backend_info) +{ +#ifdef HAVE_SABLOT_CONFIG + RETURN_STRING(SAB_INFO, strlen(SAB_INFO)); +#else + RETURN_STRING(XSLT_NO_INFO, strlen(XSLT_NO_INFO)); +#endif +} +/* }}} */ /* {{{ free_processor() Free an XSLT processor */ static void free_processor(zend_rsrc_list_entry *rsrc TSRMLS_DC) diff --git a/ext/xslt/tests/xslt_backend_info.phpt b/ext/xslt/tests/xslt_backend_info.phpt new file mode 100644 index 0000000000..7db91579f3 --- /dev/null +++ b/ext/xslt/tests/xslt_backend_info.phpt @@ -0,0 +1,49 @@ +--TEST-- +xslt_backend_info: examples for detection of backend features +--SKIPIF-- + +--FILE-- + +--EXPECTREGEX-- +You (don't )?have iconv support +You (don't )?have JavaScript support