root/trunk/php_xsl.h

Revision 1, 4.2 kB (checked in by harrisj, 2 years ago)

Initial import from internal repository

Line 
1 /*
2   +----------------------------------------------------------------------+
3   | PHP Version 5                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 1997-2006 The PHP Group                                |
6   +----------------------------------------------------------------------+
7   | This source file is subject to version 3.01 of the PHP license,      |
8   | that is bundled with this package in the file LICENSE, and is        |
9   | available through the world-wide-web at the following url:           |
10   | http://www.php.net/license/3_01.txt                                  |
11   | If you did not receive a copy of the PHP license and are unable to   |
12   | obtain it through the world-wide-web, please send a note to          |
13   | license@php.net so we can mail you a copy immediately.               |
14   +----------------------------------------------------------------------+
15   | Author:                                                              |
16   +----------------------------------------------------------------------+
17 */
18
19 /* $Id: php_xsl.h,v 1.5 2007/03/08 16:58:14 harrisj Exp $ */
20
21 #ifndef PHP_XSL_H
22 #define PHP_XSL_H
23
24 extern zend_module_entry xsl_module_entry;
25 #define phpext_xsl_ptr &xsl_module_entry
26
27 #ifdef PHP_WIN32
28 #define PHP_XSL_API __declspec(dllexport)
29 #else
30 #define PHP_XSL_API
31 #endif
32
33 #ifdef ZTS
34 #include "TSRM.h"
35 #endif
36
37 #include <libxslt/xsltconfig.h>
38 #include <libxslt/xsltInternals.h>
39 #include <libxslt/xsltutils.h>
40 #include <libxslt/transform.h>
41 #if HAVE_XSL_EXSLT
42 #include <libexslt/exslt.h>
43 #include <libexslt/exsltconfig.h>
44 #endif
45
46 #include "ext/dom/xml_common.h"
47 #include "xsl_fe.h"
48
49 #include <libxslt/extensions.h>
50 #include <libxml/xpathInternals.h>
51
52 typedef struct _persist_xsl_object {
53         char *persist_key;
54         xsltStylesheetPtr sheetp;
55         time_t create_time;
56         time_t lastused_time;
57         HashTable *sheet_paths;
58         zend_bool keep_cached;
59 } persist_xsl_object;
60
61 typedef struct _xsl_object {
62         zend_object  std;
63         HashTable *prop_handler;
64         HashTable *node_list;
65
66         zend_object_handle handle;
67         HashTable *parameter;
68         int hasKeys;
69         int registerPhpFunctions;
70         HashTable *registered_phpfunctions;
71   php_libxml_node_object *doc;
72        
73         persist_xsl_object *xslp;
74 } xsl_object;
75
76 void php_xslcache_set_object(zval *wrapper, void *obj TSRMLS_DC);
77 void xslcache_objects_free_storage(void *object TSRMLS_DC);
78 zval *php_xslcache_create_object(xsltStylesheetPtr obj, int *found, zval *wrapper_in, zval *return_value  TSRMLS_DC);
79
80 void xsl_ext_function_string_php(xmlXPathParserContextPtr ctxt, int nargs);
81 void xsl_ext_function_object_php(xmlXPathParserContextPtr ctxt, int nargs);
82
83 #define REGISTER_XSLCACHE_CLASS(ce, name, parent_ce, funcs, entry) \
84 INIT_CLASS_ENTRY(ce, name, funcs); \
85 ce.create_object = xslcache_objects_new; \
86 entry = zend_register_internal_class_ex(&ce, parent_ce, NULL TSRMLS_CC);
87
88 #define XSL_DOMOBJ_NEW(zval, obj, ret) \
89         if (NULL == (zval = php_xslcache_create_object(obj, ret, zval, return_value TSRMLS_CC))) { \
90                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot create required DOM object"); \
91                 RETURN_FALSE; \
92         }
93
94 PHP_MINIT_FUNCTION(xslcache);
95 PHP_MSHUTDOWN_FUNCTION(xslcache);
96 PHP_RINIT_FUNCTION(xslcache);
97 PHP_RSHUTDOWN_FUNCTION(xslcache);
98 PHP_MINFO_FUNCTION(xslcache);
99
100
101 /*
102         Declare any global variables you may need between the BEGIN
103         and END macros here:     
104
105 ZEND_BEGIN_MODULE_GLOBALS(xsl)
106         long  global_value;
107         char *global_string;
108 ZEND_END_MODULE_GLOBALS(xsl)
109 */
110
111
112 /* In every utility function you add that needs to use variables
113    in php_xslcache_globals, call TSRM_FETCH(); after declaring other
114    variables used by that function, or better yet, pass in TSRMLS_CC
115    after the last function argument and declare your utility function
116    with TSRMLS_DC after the last declared argument.  Always refer to
117    the globals in your function as XSL_G(variable).  You are
118    encouraged to rename these macros something shorter, see
119    examples in any other php module directory.
120 */
121
122 #ifdef ZTS
123 #define XSL_G(v) TSRMG(xsl_globals_id, zend_xsl_globals *, v)
124 #else
125 #define XSL_G(v) (xsl_globals.v)
126 #endif
127 #endif  /* PHP_XSL_H */
128
129
130 /*
131  * Local variables:
132  * tab-width: 4
133  * c-basic-offset: 4
134  * End:
135  * vim600: noet sw=4 ts=4 fdm=marker
136  * vim<600: noet sw=4 ts=4
137  */
Note: See TracBrowser for help on using the browser.