summaryrefslogtreecommitdiff
path: root/ext/sablot/php_sablot.h
blob: 38f3dc0ef7e9e7ad957f379f92d04273a6c3fcba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
   +----------------------------------------------------------------------+
   | PHP version 4.0                                                      |
   +----------------------------------------------------------------------+
   | Copyright (c) 1997-2001 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 2.02 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |
   | available at through the world-wide-web at                           |
   | http://www.php.net/license/2_02.txt.                                 |
   | If you did not receive a copy of the PHP license and are unable to   |
   | obtain it through the world-wide-web, please send a note to          |
   | license@php.net so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
   | Authors: Sterling Hughes <sterling@php.net>                          |
   +----------------------------------------------------------------------+
 */

#ifndef PHP_SABLOT_H
#define PHP_SABLOT_H

#if HAVE_SABLOT

#include <sablot.h>

extern zend_module_entry sablot_module_entry;
#define phpext_sablot_ptr &sablot_module_entry

#ifdef PHP_WIN32
#define PHP_SABLOT_API __declspec(dllexport)
#else
#define PHP_SABLOT_API
#endif

/* Module functions */
PHP_MINIT_FUNCTION(sablot);
PHP_MINFO_FUNCTION(sablot);
PHP_MSHUTDOWN_FUNCTION(sablot);

/* Request functions */
PHP_RSHUTDOWN_FUNCTION(sablot);

/* Output transformation functions */
PHP_FUNCTION(xslt_output_begintransform);
PHP_FUNCTION(xslt_output_endtransform);

/* Basic transformation functions */
PHP_FUNCTION(xslt_transform);
PHP_FUNCTION(xslt_process);

/* Advanced API transformation functions */
PHP_FUNCTION(xslt_create);
PHP_FUNCTION(xslt_run);
PHP_FUNCTION(xslt_set_sax_handler);
PHP_FUNCTION(xslt_set_scheme_handler);
PHP_FUNCTION(xslt_set_error_handler);
#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);

/* Error Handling functions */
PHP_FUNCTION(xslt_error);
PHP_FUNCTION(xslt_errno);
PHP_FUNCTION(xslt_openlog);
PHP_FUNCTION(xslt_closelog);

/* Sablotron error structure */
struct _php_sablot_error {
	char *key;
	char *value;
	struct _php_sablot_error *next;
};

typedef struct _php_sablot_error php_sablot_error;


/* Sablotron Handle */
typedef struct {

    /* Error Handling */
    zval *errorHandler;
	php_sablot_error *errors;
	php_sablot_error errors_start;
	int last_errno;
	
    /* SAX Handling */
	long index;
	zval *startDocHandler;
	zval *startElementHandler;
	zval *endElementHandler;
	zval *startNamespaceHandler;
	zval *endNamespaceHandler;
	zval *commentHandler;
	zval *PIHandler;
	zval *charactersHandler;
	zval *endDocHandler;
	
    /* Scheme Handling */
	zval *getAllHandler;

	/* Sablotron Related */
	SablotHandle p;

} php_sablot;


/* Sablotron Globals */
typedef struct {
    zval *errorHandler;
    php_sablot_error *errors;
    php_sablot_error errors_start;
	char *output_transform_file; /* For output transformations */
	int last_errno;              /* Global last_errno, if no handle is found */
	SablotHandle processor;
} php_sablot_globals;


#ifdef ZTS
#define SABLOTG(v) TSRMG(sablot_globals_id, php_sablot_globals *, v)
#else
#define SABLOTG(v) (sablot_globals.v)
#endif

#else
#define phpext_sablot_ptr NULL
#endif

#endif

/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * End:
 */