Project

Profile

Help

Bug #4274 » php_saxon.h

O'Neil Delpratt, 2019-08-14 00:15

 
1
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright (c) 2014 Saxonica Limited.
3
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
// This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////#ifndef PHP_SAXON_H
7

    
8
#ifndef PHP_SAXON_H
9
#define PHP_SAXON_H
10

    
11
#ifdef __cplusplus
12
extern "C" {
13
#endif
14

    
15
    #include "php.h"
16
        #include "php_ini.h"
17
        #include "ext/standard/info.h"
18
        #include "Zend/zend_exceptions.h"
19
        
20

    
21

    
22
#include "zend_interfaces.h"
23
#include "zend_ini.h"
24
#include "zend_closures.h"
25
#include "SAPI.h"
26
#ifdef PHP_WIN32
27
        #define _ALLOW_KEYWORD_MACROS
28
#endif
29

    
30
#ifdef PHP_WIN32
31
        #define PHP_SAXON_API __declspec(dllexport)
32
        #define PHP_SAXON __declspec(dllimport)
33
//#elif define(__GNUC__) && __GNUC__ >= 4
34
//#define PHP_SAXON __attribute__ ((visibility("default")))
35
//#else
36
//#define PHP_SAXON_API
37
#endif
38

    
39
#ifdef ZTS
40
#include "TSRM.h"
41
#endif
42
#ifdef __cplusplus
43
}
44
#endif
45
#include "SaxonProcessor.h"
46
#include "XdmValue.h"
47
#include "XdmItem.h"
48
#include "XdmNode.h"
49
#include "XdmAtomicValue.h"
50
/*class SaxonProcessor;
51
class XQueryProcessor;
52
class XsltProcessor;
53
class XdmValue;*/
54

    
55
extern zend_module_entry saxon_module_entry;
56
#define phpext_saxon_ptr &saxon_module_entry;
57

    
58
#ifdef PHP_WIN32
59
#        define PHP_SAXON_API __declspec(dllexport)
60
#elif defined(__GNUC__) && __GNUC__ >= 4
61
#        define PHP_SAXON_API __attribute__ ((visibility("default")))
62
#else
63
#        define PHP_SAXON_API
64
#endif
65

    
66
#define SAXON_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(saxon, v)
67

    
68
#if defined(ZTS) && defined(COMPILE_DL_SAXON)
69
ZEND_TSRMLS_CACHE_EXTERN()
70
#endif
71

    
72
#if PHP_MAJOR_VERSION < 7
73
#define _ZVAL_STRING(str, len) ZVAL_STRING(str, len, 0)
74
#define _RETURN_STRING(str) RETURN_STRING(str, 0)
75
#else
76
#define _ZVAL_STRING(str, len) ZVAL_STRING(str, len)
77
#define _RETURN_STRING(str) RETURN_STRING(str)
78
#endif
79

    
80

    
81

    
82

    
83
struct zvalArr {
84
    zval * _val;
85
};
86

    
87
struct saxonProcessor_object {
88

    
89
    SaxonProcessor * saxonProcessor;
90
    zend_object std;
91
};
92

    
93
struct xsltProcessor_object {
94

    
95
    XsltProcessor *xsltProcessor;
96
    zend_object std;
97
};
98

    
99
struct xqueryProcessor_object {
100
    XQueryProcessor *xqueryProcessor;
101
    zend_object std;
102
};
103

    
104
struct xpathProcessor_object {
105
    
106
    XPathProcessor *xpathProcessor;
107
    zend_object std;
108
};
109

    
110
struct schemaValidator_object {
111

    
112
    SchemaValidator * schemaValidator;
113
    zend_object std;
114
};
115

    
116
struct xdmValue_object {
117

    
118
    XdmValue * xdmValue;
119
    zend_object std;
120
};
121

    
122
struct xdmItem_object {
123

    
124
    XdmItem * xdmItem;
125
    zend_object std;
126
};
127

    
128
struct xdmNode_object {
129

    
130
    XdmNode * xdmNode;
131
    zend_object std;
132
};
133

    
134
struct xdmAtomicValue_object {
135

    
136
    XdmAtomicValue * xdmAtomicValue;
137
    zend_object std;
138
};
139

    
140

    
141
#define PHP_SAXON_EXTNAME  "Saxon/C"
142
#define PHP_SAXON_EXTVER   "1.1.0"
143

    
144
/*
145
 * Class:     com_saxonica_functions_extfn_PhpCall_PhpFunctionCall
146
 * Method:    _phpCall
147
 * Signature: ([Ljava/lang/String;[Ljava/lang/String;)Ljava/lang/Object;
148
 */
149

    
150
jobject JNICALL phpNativeCall
151
  (JNIEnv *env, jobject object, jstring funcName, jobjectArray arguments, jobjectArray arrayTypes);
152
        
153
        PHP_MSHUTDOWN_FUNCTION(saxon);
154
        PHP_MINFO_FUNCTION(saxon);
155
        PHP_MINIT_FUNCTION(saxon);
156

    
157
    PHP_METHOD(SaxonProcessor,  __construct);
158
    PHP_METHOD(SaxonProcessor,  __destruct);
159

    
160
    PHP_METHOD(SaxonProcessor,  createAtomicValue);
161
    PHP_METHOD(SaxonProcessor,  parseXmlFromString);
162
    PHP_METHOD(SaxonProcessor,  parseXmlFromFile);
163
    PHP_METHOD(SaxonProcessor,  setcwd);
164
//    PHP_METHOD(SaxonProcessor,  importDocument);
165
    PHP_METHOD(SaxonProcessor,  setResourcesDirectory);
166
    PHP_METHOD(SaxonProcessor,  setCatalog);
167
    PHP_METHOD(SaxonProcessor,  registerPHPFunctions);
168
 //   PHP_METHOD(SaxonProcessor,  getXslMessages);
169
    PHP_METHOD(SaxonProcessor, setConfigurationProperty);
170
    PHP_METHOD(SaxonProcessor, newXsltProcessor);
171
    PHP_METHOD(SaxonProcessor, newXQueryProcessor);
172
    PHP_METHOD(SaxonProcessor, newXPathProcessor);
173
    PHP_METHOD(SaxonProcessor, newSchemaValidator);
174
    PHP_METHOD(SaxonProcessor,  version);
175

    
176

    
177

    
178

    
179
    //PHP_METHOD(XsltProcessor,  __construct);
180
    PHP_METHOD(XsltProcessor,  __destruct);
181
    PHP_METHOD(XsltProcessor,  transformFileToFile);
182
    PHP_METHOD(XsltProcessor,  transformFileToString);
183
    PHP_METHOD(XsltProcessor,  transformFileToValue);
184
    PHP_METHOD(XsltProcessor,  transformToString);
185
    PHP_METHOD(XsltProcessor,  transformToValue);
186
    PHP_METHOD(XsltProcessor,  transformToFile);
187
    PHP_METHOD(XsltProcessor, compileFromFile);
188
    PHP_METHOD(XsltProcessor, compileFromValue);
189
    PHP_METHOD(XsltProcessor, compileFromString);
190
    PHP_METHOD(XsltProcessor, compileFromStringAndSave);
191
    PHP_METHOD(XsltProcessor, compileFromFileAndSave);
192
    PHP_METHOD(XsltProcessor,  setOutputFile);
193
    PHP_METHOD(XsltProcessor,  setSourceFromFile);
194
    PHP_METHOD(XsltProcessor,  setSourceFromXdmValue);
195
    PHP_METHOD(XsltProcessor,  setParameter);
196
    PHP_METHOD(XsltProcessor,  setProperty);
197
    PHP_METHOD(XsltProcessor,  clearParameters);
198
    PHP_METHOD(XsltProcessor,  clearProperties);
199
    PHP_METHOD(XsltProcessor,  exceptionClear);
200
    PHP_METHOD(XsltProcessor,  exceptionOccurred);
201
    PHP_METHOD(XsltProcessor,  getErrorCode);
202
    PHP_METHOD(XsltProcessor,  getErrorMessage);
203
    PHP_METHOD(XsltProcessor,  getExceptionCount);
204

    
205
   // PHP_METHOD(XQueryProcesor,  __construct);
206
    PHP_METHOD(XQueryProcesor,  __destruct);
207
    PHP_METHOD(XQueryProcessor,  setQueryContent);
208
    PHP_METHOD(XQueryProcessor,  setContextItem);
209
    PHP_METHOD(XQueryProcessor,  setContextItemFromFile);
210
    PHP_METHOD(XQueryProcessor,  setParameter);
211
    PHP_METHOD(XQueryProcessor,  setProperty);
212
    PHP_METHOD(XQueryProcessor,  clearParameters);
213
    PHP_METHOD(XQueryProcessor,  clearProperties);
214
   // PHP_METHOD(XQueryProcessor, setOutputFile);
215
    PHP_METHOD(XQueryProcessor, runQueryToValue);
216
    PHP_METHOD(XQueryProcessor, runQueryToString);
217
    PHP_METHOD(XQueryProcessor, runQueryToFile);
218
    PHP_METHOD(XQueryProcessor, setQueryFile);
219
    PHP_METHOD(XQueryProcessor, setQueryBaseURI);
220
    PHP_METHOD(XQueryProcessor, declareNamespace);
221
    PHP_METHOD(XQueryProcessor,  exceptionClear);
222
    PHP_METHOD(XQueryProcessor,  exceptionOccurred);
223
    PHP_METHOD(XQueryProcessor,  getErrorCode);
224
    PHP_METHOD(XQueryProcessor,  getErrorMessage);
225
    PHP_METHOD(XQueryProcessor,  getExceptionCount);
226

    
227
   // PHP_METHOD(XPathProcessor,  __construct);
228
    PHP_METHOD(XPathProcessor,  __destruct);
229
    PHP_METHOD(XPathProcessor,  setContextItem);
230
    PHP_METHOD(XPathProcessor,  setContextFile);
231
    PHP_METHOD(XQueryProcessor, setBaseURI);
232
    PHP_METHOD(XPathProcessor,  effectiveBooleanValue);
233
    PHP_METHOD(XPathProcessor,  evaluate);
234
    PHP_METHOD(XPathProcessor,  evaluateSingle);
235
    PHP_METHOD(XPathProcessor, declareNamespace);
236
    PHP_METHOD(XPathProcessor,  setParameter);
237
    PHP_METHOD(XPathProcessor,  setProperty);
238
    PHP_METHOD(XPathProcessor,  clearParameters);
239
    PHP_METHOD(XPathProcessor,  clearProperties);
240
    PHP_METHOD(XPathProcessor,  exceptionClear);
241
    PHP_METHOD(XPathProcessor,  exceptionOccurred);
242
    PHP_METHOD(XPathProcessor,  getErrorCode);
243
    PHP_METHOD(XPathProcessor,  getErrorMessage);
244
    PHP_METHOD(XPathProcessor,  getExceptionCount);
245

    
246

    
247
   // PHP_METHOD(SchemaValidator,  __construct);
248
    PHP_METHOD(SchemaValidator,  __destruct);
249
    PHP_METHOD(SchemaValidator,  setSourceNode);
250
    PHP_METHOD(SchemaValidator,  setOutputFile);
251
    PHP_METHOD(SchemaValidator, registerSchemaFromFile);
252
    PHP_METHOD(SchemaValidator, registerSchemaFromString);
253
    PHP_METHOD(SchemaValidator, validate); 
254
    PHP_METHOD(SchemaValidator, validateToNode);
255
    PHP_METHOD(SchemaValidator, getValidationReport);
256
    PHP_METHOD(SchemaValidator,  setParameter);
257
    PHP_METHOD(SchemaValidator,  setProperty);
258
    PHP_METHOD(SchemaValidator,  clearParameters);
259
    PHP_METHOD(SchemaValidator,  clearProperties);
260
    PHP_METHOD(SchemaValidator,  exceptionClear);
261
    PHP_METHOD(SchemaValidator,  exceptionOccurred);
262
    PHP_METHOD(SchemaValidator,  getErrorCode);
263
    PHP_METHOD(SchemaValidator,  getErrorMessage);
264
    PHP_METHOD(SchemaValidator,  getExceptionCount); 
265
        
266

    
267
/*     ============== PHP Interface of   XdmValue =============== */
268

    
269
    PHP_METHOD(XdmValue,  __construct);
270
    PHP_METHOD(XdmValue,  __destruct);
271
    PHP_METHOD(XdmValue,  getHead);
272
    PHP_METHOD(XdmValue,  itemAt);
273
    PHP_METHOD(XdmValue,  size);
274
    PHP_METHOD(XdmValue, addXdmItem);
275

    
276

    
277
/*     ============== PHP Interface of   XdmItem =============== */
278

    
279
    PHP_METHOD(XdmItem,  __construct);
280
    PHP_METHOD(XdmItem,  __destruct);
281
    PHP_METHOD(XdmItem,  getStringValue);
282
    PHP_METHOD(XdmItem,  isAtomic);
283
    PHP_METHOD(XdmItem,  isNode);
284
    PHP_METHOD(XdmItem,  getAtomicValue);
285
    PHP_METHOD(XdmItem,  getNodeValue);        
286

    
287
/*     ============== PHP Interface of   XdmNode =============== */
288

    
289
    PHP_METHOD(XdmNode,  __construct);
290
    PHP_METHOD(XdmNode,  __destruct);
291
    PHP_METHOD(XdmNode,  getStringValue);
292
    PHP_METHOD(XdmNode, getNodeKind);
293
    PHP_METHOD(XdmNode, getNodeName);
294
    PHP_METHOD(XdmNode,  isAtomic);
295
    PHP_METHOD(XdmNode,  getChildCount);   
296
    PHP_METHOD(XdmNode,  getAttributeCount); 
297
    PHP_METHOD(XdmNode,  getChildNode);
298
    PHP_METHOD(XdmNode,  getParent);
299
    PHP_METHOD(XdmNode,  getAttributeNode);
300
    PHP_METHOD(XdmNode,  getAttributeValue);
301
    
302

    
303
/*     ============== PHP Interface of   XdmAtomicValue =============== */
304

    
305
    PHP_METHOD(XdmAtomicValue,  __construct);
306
    PHP_METHOD(XdmAtomicValue,  __destruct);
307
    PHP_METHOD(XdmAtomicValue,  getStringValue);
308
    PHP_METHOD(XdmAtomicValue,  getBooleanValue);
309
    PHP_METHOD(XdmAtomicValue,  getDoubleValue);
310
    PHP_METHOD(XdmAtomicValue,  getLongValue);
311
    PHP_METHOD(XdmAtomicValue,  isAtomic);
312

    
313

    
314
#endif /* PHP_SAXON_H */
315

    
316

    
317

    
318

    
319

    
320

    
321

    
322

    
323

    
324

    
325

    
326

    
327

    
328

    
329

    
330

    
331

    
(2-2/4)