sterling                Tue Jan 16 04:02:47 2001 EDT

  Modified files:              
    /php4/ext/sablot    php_sablot.h sablot.c 
  Log:
  @ Added the xslt_set_base function. (Sterling)
  
  Added the SABLOT_SET_ERROR() macro to set sablotron errors...
  
  
  
Index: php4/ext/sablot/php_sablot.h
diff -u php4/ext/sablot/php_sablot.h:1.11 php4/ext/sablot/php_sablot.h:1.12
--- php4/ext/sablot/php_sablot.h:1.11   Sat Jan  6 00:37:00 2001
+++ php4/ext/sablot/php_sablot.h        Tue Jan 16 04:02:47 2001
@@ -56,6 +56,7 @@
 #ifdef HAVE_SABLOT_SET_ENCODING
 PHP_FUNCTION(xslt_set_encoding);
 #endif
+PHP_FUNCTION(xslt_set_base);
 PHP_FUNCTION(xslt_fetch_result);
 PHP_FUNCTION(xslt_free);
 
Index: php4/ext/sablot/sablot.c
diff -u php4/ext/sablot/sablot.c:1.28 php4/ext/sablot/sablot.c:1.29
--- php4/ext/sablot/sablot.c:1.28       Tue Jan  9 12:17:11 2001
+++ php4/ext/sablot/sablot.c    Tue Jan 16 04:02:47 2001
@@ -99,6 +99,15 @@
 
 #define SABLOT_BASIC_HANDLE SABLOTG(processor)
 
+#define SABLOT_SET_ERROR(handle, error)   \
+       if (error != 0) {                     \
+               if (handle) {                     \
+                       handle->last_errno = error;   \
+               }                                 \
+                                                 \
+               SABLOTG(last_errno) = error;      \
+       }
+
 /**
  * SAX Handler structure, this defines the different functions to be
  * called when Sablotron's internal expat parser reaches the 
@@ -150,6 +159,7 @@
     PHP_FE(xslt_closelog,                 NULL)
     PHP_FE(xslt_set_sax_handler,          NULL)
     PHP_FE(xslt_set_error_handler,        NULL)
+    PHP_FE(xslt_set_base,                 NULL)
 #ifdef HAVE_SABLOT_SET_ENCODING
     PHP_FE(xslt_set_encoding,             NULL)
 #endif
@@ -865,6 +875,50 @@
 
 #endif
 
+/* {{{ proto bool xslt_set_base(resource xh, string scheme, string base)
+   Overrides the default base for a resource.  If scheme is non-null, it only affects 
+the uri given by scheme */
+PHP_FUNCTION(xslt_set_base)
+{
+       zval       **xh, **scheme, **base;
+       php_sablot  *handle;
+       int          argc = ZEND_NUM_ARGS(),
+                    ret  = 0;
+       SABLOTLS_FETCH();
+
+       if (argc < 2 || argc > 3 ||
+           zend_get_parameters_ex(argc, &xh, &scheme, &base,) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+       
+       if (argc > 2) {
+               ZEND_FETCH_RESOURCE(handle, php_sablot *, xh, -1, "PHP-Sablotron 
+handle", le_sablot);
+               
+               if (Z_TYPE_PP(scheme) != IS_STRING) {
+                       ret = SablotSetBase(handle->p, Z_STRVAL_PP(base));
+               } else {
+                       ret = SablotSetBaseForScheme((void *) handle->p,
+                                                    Z_STRVAL_PP(scheme),
+                                                    Z_STRVAL_PP(base));
+               }
+       } else {
+               if (Z_TYPE_PP(scheme) != IS_STRING) {
+                       ret = SablotSetBase(SABLOTG(processor), Z_STRVAL_PP(base));
+               } else {
+                       ret = SablotSetBaseForScheme((void *) SABLOTG(processor),
+                                                    Z_STRVAL_PP(scheme),
+                                                    Z_STRVAL_PP(base));
+               }
+       }
+       
+       SABLOT_SET_ERROR(handle, ret);
+       
+       if (ret != 0) {
+               RETURN_FALSE;
+       } else {
+               RETURN_TRUE;
+       }
+}
+/* }}} */
 
 /* }}} */
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to