cvs: php4 /ext/sablot config.m4 php_sablot.h sablot.c
| From: | Rui Hirokawa | Date: | Sat, 06 Jan 2001 08:37:01 +0000 |
| Subject: | cvs: php4 /ext/sablot config.m4 php_sablot.h sablot.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-3399@lists.php.net to get a copy of this message | ||
hirokawa Sat Jan 6 00:37:01 2001 EDT
Modified files:
/php4/ext/sablot config.m4 php_sablot.h sablot.c
Log:
linked with libexpat. it's necessary to use sablot-0.50. added xslt_set_encoding() function.
Index: php4/ext/sablot/config.m4
diff -u php4/ext/sablot/config.m4:1.8 php4/ext/sablot/config.m4:1.9
--- php4/ext/sablot/config.m4:1.8 Thu Nov 2 17:56:58 2000
+++ php4/ext/sablot/config.m4 Sat Jan 6 00:37:00 2001
@@ -1,4 +1,4 @@
-dnl $Id: config.m4,v 1.8 2000/11/03 01:56:58 sniper Exp $
+dnl $Id: config.m4,v 1.9 2001/01/06 08:37:00 hirokawa Exp $
dnl config.m4 for extension Sablot
PHP_ARG_WITH(sablot, for Sablotron XSL support,
@@ -26,8 +26,15 @@
PHP_SUBST(SABLOT_SHARED_LIBADD)
AC_ADD_LIBRARY_WITH_PATH(sablot, $SABLOT_DIR/lib, SABLOT_SHARED_LIBADD)
- AC_ADD_LIBRARY(xmlparse)
- AC_ADD_LIBRARY(xmltok)
+
+ if test -f $SABLOT_DIR/lib/libexpat.a -o -f $SABLOT_DIR/lib/libexpat.so ; then
+ AC_ADD_LIBRARY(expat)
+ AC_CHECK_LIB(sablot, SablotSetEncoding,
+ AC_DEFINE(HAVE_SABLOT_SET_ENCODING,1,[ ]))
+ else
+ AC_ADD_LIBRARY(xmlparse)
+ AC_ADD_LIBRARY(xmltok)
+ fi
AC_DEFINE(HAVE_SABLOT,1,[ ])
Index: php4/ext/sablot/php_sablot.h
diff -u php4/ext/sablot/php_sablot.h:1.10 php4/ext/sablot/php_sablot.h:1.11
--- php4/ext/sablot/php_sablot.h:1.10 Mon Dec 11 06:15:09 2000
+++ php4/ext/sablot/php_sablot.h Sat Jan 6 00:37:00 2001
@@ -53,6 +53,9 @@
PHP_FUNCTION(xslt_run);
PHP_FUNCTION(xslt_set_sax_handler);
PHP_FUNCTION(xslt_set_error_handler);
+#ifdef HAVE_SABLOT_SET_ENCODING
+PHP_FUNCTION(xslt_set_encoding);
+#endif
PHP_FUNCTION(xslt_fetch_result);
PHP_FUNCTION(xslt_free);
Index: php4/ext/sablot/sablot.c
diff -u php4/ext/sablot/sablot.c:1.26 php4/ext/sablot/sablot.c:1.27
--- php4/ext/sablot/sablot.c:1.26 Fri Dec 22 04:57:07 2000
+++ php4/ext/sablot/sablot.c Sat Jan 6 00:37:00 2001
@@ -150,6 +150,9 @@
PHP_FE(xslt_closelog, NULL)
PHP_FE(xslt_set_sax_handler, NULL)
PHP_FE(xslt_set_error_handler, NULL)
+#ifdef HAVE_SABLOT_SET_ENCODING
+ PHP_FE(xslt_set_encoding, NULL)
+#endif
PHP_FE(xslt_free, NULL)
PHP_FE(xslt_error, NULL)
PHP_FE(xslt_errno, NULL)
@@ -975,6 +978,33 @@
}
}
/* }}} */
+
+#ifdef HAVE_SABLOT_SET_ENCODING
+/* {{{ proto void xslt_set_encoding(resource xh, string encoding)
+ Sets output encoding to be used for Sablotron regardless of the
+ encoding specified by the stylesheet. To unset, call with
+ encoding_ NULL. */
+PHP_FUNCTION(xslt_set_encoding)
+{
+ zval **xh, **encoding;
+ php_sablot *handle;
+ int ret = 0,
+ loglevel = 0,
+ argc = ZEND_NUM_ARGS();
+ SABLOTLS_FETCH();
+
+ if (argc != 2 ||
+ zend_get_parameters_ex(argc, &xh, &encoding) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ ZEND_FETCH_RESOURCE(handle, php_sablot *, xh, -1, "PHP-Sablotron", le_sablot);
+ convert_to_string_ex(encoding);
+
+ SablotSetEncoding(handle->p, (char *)Z_STRVAL_PP(encoding));
+
+}
+/* }}} */
+#endif
/* {{{ _php_sablot_call_handler_function()
Call a sablot call handler function, wrapper for call_user_function() */