SaxonC  11.6
Saxon Processor library for C/C++, PHP and Python
php7_saxon.h
1 // Copyright (c) 2022 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.
7 
8 #ifndef PHP_SAXON_H
9 #define PHP_SAXON_H
10 
11 #ifdef __cplusplus
12  extern "C" { //remove comment
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 "zend_types.h"
26 #include "SAPI.h"
27 #ifdef PHP_WIN32
28  #define _ALLOW_KEYWORD_MACROS
29 #endif
30 
31 #ifdef PHP_WIN32
32  #define PHP_SAXON_API __declspec(dllexport)
33  #define PHP_SAXON __declspec(dllimport)
34 //#elif define(__GNUC__) && __GNUC__ >= 4
35 //#define PHP_SAXON __attribute__ ((visibility("default")))
36 //#else
37 //#define PHP_SAXON_API
38 #endif
39 
40 #ifdef ZTS
41 #include "TSRM.h"
42 #endif
43 #ifdef __cplusplus
44 } //remove comment
45 #endif
46 #include "SaxonProcessor.h"
47 #include "XdmValue.h"
48 #include "XdmItem.h"
49 #include "XdmNode.h"
50 #include "XdmAtomicValue.h"
51 #include "XdmFunctionItem.h"
52 #include "XdmMap.h"
53 #include "XdmArray.h"
54 
55 /*class SaxonProcessor;
56 class XQueryProcessor;
57 class XsltProcessor;
58 class XdmValue;*/
59 
60 extern zend_module_entry saxon_module_entry;
61 #define phpext_saxon_ptr &saxon_module_entry;
62 
63 #ifdef PHP_WIN32
64 # define PHP_SAXON_API __declspec(dllexport)
65 #elif defined(__GNUC__) && __GNUC__ >= 4
66 # define PHP_SAXON_API __attribute__ ((visibility("default")))
67 #else
68 # define PHP_SAXON_API
69 #endif
70 
71 #define SAXON_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(saxon, v)
72 
73 #if defined(ZTS) && defined(COMPILE_DL_SAXON)
74 ZEND_TSRMLS_CACHE_EXTERN()
75 #endif
76 
77 #if PHP_MAJOR_VERSION < 7
78 #define _ZVAL_STRING(str, len) ZVAL_STRING(str, len, 0)
79 #define _RETURN_STRING(str) RETURN_STRING(str, 0)
80 #else
81 #define _ZVAL_STRING(str, len) ZVAL_STRING(str, len)
82 #define _RETURN_STRING(str) RETURN_STRING(str)
83 #endif
84 
85 
86 
87 
88 struct zvalArr {
89  zval * _val;
90 };
91 
92 struct saxonProcessor_object {
93 
94  SaxonProcessor * saxonProcessor;
95  zend_object std;
96 };
97 
99 
100  DocumentBuilder * documentBuilder;
101  zend_object std;
102 };
103 
104 
105 struct xqueryProcessor_object {
106  XQueryProcessor *xqueryProcessor;
107  zend_object std;
108 };
109 
110 struct xpathProcessor_object {
111 
112  XPathProcessor *xpathProcessor;
113  zend_object std;
114 };
115 
116 struct schemaValidator_object {
117 
118  SchemaValidator * schemaValidator;
119  zend_object std;
120 };
121 
122 struct xdmValue_object {
123 
124  XdmValue * xdmValue;
125  zend_object std;
126 };
127 
128 struct xdmItem_object {
129 
130  XdmItem * xdmItem;
131  zend_object std;
132 };
133 
134 struct xdmNode_object {
135 
136  XdmNode * xdmNode;
137  zend_object std;
138 };
139 
140 struct xdmAtomicValue_object {
141 
142  XdmAtomicValue * xdmAtomicValue;
143  zend_object std;
144 };
145 
146 
148 
149  XdmFunctionItem * xdmFunctionItem;
150  zend_object std;
151 };
152 
153 
155 
156  XdmMap * xdmMap;
157  zend_object std;
158 };
159 
160 
162 
163  XdmArray * xdmArray;
164  zend_object std;
165 };
166 
167 struct xslt30Processor_object {
168 
169  Xslt30Processor *xslt30Processor;
170  zend_object std;
171 };
172 
174 
175  XsltExecutable *xsltExecutable;
176  zend_object std;
177 };
178 
179 
180 
181 #define PHP_SAXON_EXTNAME "saxonc"
182 #define PHP_SAXON_EXTVER "11.4"
183 
184 /*
185  * Class: com_saxonica_functions_extfn_PhpCall_PhpFunctionCall
186  * Method: _phpCall
187  * Signature: ([Ljava/lang/String;[Ljava/lang/String;)Ljava/lang/Object;
188  */
189 
190 jobject JNICALL phpNativeCall
191  (JNIEnv *env, jobject object, jstring funcName, jobjectArray arguments, jobjectArray arrayTypes);
192 
193  PHP_MSHUTDOWN_FUNCTION(saxon);
194  PHP_MINFO_FUNCTION(saxon);
195  PHP_MINIT_FUNCTION(saxon);
196 PHP_RINIT_FUNCTION(saxon);
197 
198  PHP_METHOD(SaxonProcessor, __construct);
199  PHP_METHOD(SaxonProcessor, __destruct);
200 
201  PHP_METHOD(SaxonProcessor, createAtomicValue);
202 
203  PHP_METHOD(SaxonProcessor, createXdmMapValue);
204  PHP_METHOD(SaxonProcessor, createXdmArrayValue);
205  PHP_METHOD(SaxonProcessor, createQNameValue);
206 
207  PHP_METHOD(SaxonProcessor, parseXmlFromString);
208  PHP_METHOD(SaxonProcessor, parseXmlFromFile);
209  PHP_METHOD(SaxonProcessor, parseXmlFromUri);
210  PHP_METHOD(SaxonProcessor, setcwd);
211  PHP_METHOD(SaxonProcessor, attachCurrentThread);
212  PHP_METHOD(SaxonProcessor, detachCurrentThread);
213 
214  PHP_METHOD(SaxonProcessor, setCatalog);
215  PHP_METHOD(SaxonProcessor, registerPHPFunctions);
216  PHP_METHOD(SaxonProcessor, getErrorMessage);
217  PHP_METHOD(SaxonProcessor, exceptionOccurred);
218  PHP_METHOD(SaxonProcessor, setConfigurationProperty);
219  PHP_METHOD(SaxonProcessor, clearConfigurationProperties);
220  PHP_METHOD(SaxonProcessor, newXslt30Processor);
221  PHP_METHOD(SaxonProcessor, newXQueryProcessor);
222  PHP_METHOD(SaxonProcessor, newXPathProcessor);
223  PHP_METHOD(SaxonProcessor, newSchemaValidator);
224  PHP_METHOD(SaxonProcessor, newDocumentBuilder);
225  PHP_METHOD(SaxonProcessor, version);
226  PHP_METHOD(SaxonProcessor, isSchemaAware);
227  PHP_METHOD(SaxonProcessor, release);
228  PHP_METHOD(SaxonProcessor, exceptionClear);
229  PHP_METHOD(SaxonProcessor, exceptionOccurred);
230  PHP_METHOD(SaxonProcessor, getErrorMessage);
231 
232 
233 
234  PHP_METHOD(DocumentBuilder, __destruct);
235  PHP_METHOD(DocumentBuilder, setLineNumbering);
236  PHP_METHOD(DocumentBuilder, isLineNumbering);
237  PHP_METHOD(DocumentBuilder, setSchemaValidator);
238  PHP_METHOD(DocumentBuilder, getSchemaValidator);
239  PHP_METHOD(DocumentBuilder, setDTDValidation);
240  PHP_METHOD(DocumentBuilder, isDTDValidation);
241  PHP_METHOD(DocumentBuilder, setBaseUri);
242  PHP_METHOD(DocumentBuilder, getBaseUri);
243  PHP_METHOD(DocumentBuilder, parseXmlFromString);
244  PHP_METHOD(DocumentBuilder, parseXmlFromFile);
245  PHP_METHOD(DocumentBuilder, parseXmlFromUri);
246  PHP_METHOD(DocumentBuilder, exceptionOccurred);
247  PHP_METHOD(DocumentBuilder, exceptionClear);
248  PHP_METHOD(DocumentBuilder, getErrorMessage);
249  PHP_METHOD(DocumentBuilder, getErrorCode);
250 
251 
252 
253  PHP_METHOD(Xslt30Processor, __destruct);
254  PHP_METHOD(Xslt30Processor, transformFileToFile);
255  PHP_METHOD(Xslt30Processor, transformFileToString);
256  PHP_METHOD(Xslt30Processor, transformFileToValue);
257  PHP_METHOD(Xslt30Processor, compileFromFile);
258  PHP_METHOD(Xslt30Processor, compileFromValue);
259  PHP_METHOD(Xslt30Processor, compileFromString);
260  PHP_METHOD(Xslt30Processor, compileFromStringAndSave);
261  PHP_METHOD(Xslt30Processor, compileFromFileAndSave);
262  PHP_METHOD(Xslt30Processor, compileFromAssociatedFile);
263  PHP_METHOD(Xslt30Processor, setJustInTimeCompilation);
264  PHP_METHOD(Xslt30Processor, setParameter);
265  PHP_METHOD(Xslt30Processor, clearParameters);
266  PHP_METHOD(Xslt30Processor, exceptionClear);
267  PHP_METHOD(Xslt30Processor, exceptionOccurred);
268  PHP_METHOD(Xslt30Processor, getErrorCode);
269  PHP_METHOD(Xslt30Processor, setcwd);
270 
271 
272 
273  PHP_METHOD(XsltExecutable, __destruct);
274  PHP_METHOD(XsltExecutable, callFunctionReturningValue);
275  PHP_METHOD(XsltExecutable, callFunctionReturningString);
276  PHP_METHOD(XsltExecutable, callFunctionReturningFile);
277  PHP_METHOD(XsltExecutable, callTemplateReturningValue);
278  PHP_METHOD(XsltExecutable, callTemplateReturningString);
279  PHP_METHOD(XsltExecutable, callTemplateReturningFile);
280  PHP_METHOD(XsltExecutable, applyTemplatesReturningValue);
281  PHP_METHOD(XsltExecutable, applyTemplatesReturningString);
282  PHP_METHOD(XsltExecutable, applyTemplatesReturningFile);
283  PHP_METHOD(XsltExecutable, clone);
284  PHP_METHOD(XsltExecutable, transformFileToFile);
285  PHP_METHOD(XsltExecutable, transformFileToString);
286  PHP_METHOD(XsltExecutable, transformFileToValue);
287  PHP_METHOD(XsltExecutable, transformToString);
288  PHP_METHOD(XsltExecutable, transformToValue);
289  PHP_METHOD(XsltExecutable, transformToFile);
290  PHP_METHOD(XsltExecutable, setOutputFile);
291  PHP_METHOD(XsltExecutable, setResultAsRawValue);
292  PHP_METHOD(XsltExecutable, setParameter);
293  PHP_METHOD(XsltExecutable, setBaseOutputURI);
294  PHP_METHOD(XsltExecutable, setInitialMode);
295  PHP_METHOD(XsltExecutable, setInitialTemplateParameters);
296  PHP_METHOD(XsltExecutable, setInitialMatchSelection);
297  PHP_METHOD(XsltExecutable, setInitialMatchSelectionAsFile);
298  PHP_METHOD(XsltExecutable, setGlobalContextItem);
299  PHP_METHOD(XsltExecutable, setGlobalContextFromFile);
300  PHP_METHOD(XsltExecutable, setcwd);
301  PHP_METHOD(XsltExecutable, setProperty);
302  PHP_METHOD(XsltExecutable, clearParameters);
303  PHP_METHOD(XsltExecutable, clearProperties);
304  PHP_METHOD(XsltExecutable, exportStylesheet);
305  PHP_METHOD(XsltExecutable, exceptionClear);
306  PHP_METHOD(XsltExecutable, exceptionOccurred);
307  PHP_METHOD(XsltExecutable, checkForException);
308  PHP_METHOD(XsltExecutable, getErrorCode);
309  PHP_METHOD(XsltExecutable, getErrorMessage);
310  PHP_METHOD(XsltExecutable, setSaveXslMessage);
311  PHP_METHOD(XsltExecutable, setCaptureResultDocuments);
312  PHP_METHOD(XsltExecutable, getResultDocuments);
313 
314 
315 // PHP_METHOD(XQueryProcesor, __construct);
316  PHP_METHOD(XQueryProcesor, __destruct);
317  PHP_METHOD(XQueryProcessor, setQueryContent);
318  PHP_METHOD(XQueryProcessor, setContextItem);
319  PHP_METHOD(XQueryProcessor, setContextItemFromFile);
320  PHP_METHOD(XQueryProcessor, setParameter);
321  PHP_METHOD(XQueryProcessor, setProperty);
322  PHP_METHOD(XQueryProcessor, clearParameters);
323  PHP_METHOD(XQueryProcessor, clearProperties);
324  // PHP_METHOD(XQueryProcessor, setOutputFile);
325  PHP_METHOD(XQueryProcessor, runQueryToValue);
326  PHP_METHOD(XQueryProcessor, runQueryToString);
327  PHP_METHOD(XQueryProcessor, runQueryToFile);
328  PHP_METHOD(XQueryProcessor, setQueryFile);
329  PHP_METHOD(XQueryProcessor, setQueryBaseURI);
330  PHP_METHOD(XQueryProcessor, declareNamespace);
331  PHP_METHOD(XQueryProcessor, exceptionClear);
332  PHP_METHOD(XQueryProcessor, exceptionOccurred);
333  PHP_METHOD(XQueryProcessor, getErrorCode);
334  PHP_METHOD(XQueryProcessor, getErrorMessage);
335 
336  // PHP_METHOD(XPathProcessor, __construct);
337  PHP_METHOD(XPathProcessor, __destruct);
338  PHP_METHOD(XPathProcessor, setContextItem);
339  PHP_METHOD(XPathProcessor, setContextFile);
340  PHP_METHOD(XQueryProcessor, setBaseURI);
341  PHP_METHOD(XPathProcessor, effectiveBooleanValue);
342  PHP_METHOD(XPathProcessor, evaluate);
343  PHP_METHOD(XPathProcessor, evaluateSingle);
344  PHP_METHOD(XPathProcessor, declareNamespace);
345  PHP_METHOD(XPathProcessor, setBackwardsCompatible); //new
346  PHP_METHOD(XPathProcessor, setCaching); //new
347  PHP_METHOD(XPathProcessor, importSchemaNamespace); //new
348  PHP_METHOD(XPathProcessor, setParameter);
349  PHP_METHOD(XPathProcessor, setProperty);
350  PHP_METHOD(XPathProcessor, clearParameters);
351  PHP_METHOD(XPathProcessor, clearProperties);
352  PHP_METHOD(XPathProcessor, exceptionClear);
353  PHP_METHOD(XPathProcessor, exceptionOccurred);
354  PHP_METHOD(XPathProcessor, getErrorCode);
355  PHP_METHOD(XPathProcessor, getErrorMessage);
356 
357 
358  // PHP_METHOD(SchemaValidator, __construct);
359  PHP_METHOD(SchemaValidator, __destruct);
360  PHP_METHOD(SchemaValidator, setSourceNode);
361  PHP_METHOD(SchemaValidator, setOutputFile);
362  PHP_METHOD(SchemaValidator, exportSchema);
363  PHP_METHOD(SchemaValidator, registerSchemaFromFile);
364  PHP_METHOD(SchemaValidator, registerSchemaFromString);
365  PHP_METHOD(SchemaValidator, validate);
366  PHP_METHOD(SchemaValidator, validateToNode);
367  PHP_METHOD(SchemaValidator, getValidationReport);
368  PHP_METHOD(SchemaValidator, setLax); // new
369  PHP_METHOD(SchemaValidator, setParameter);
370  PHP_METHOD(SchemaValidator, setProperty);
371  PHP_METHOD(SchemaValidator, clearParameters);
372  PHP_METHOD(SchemaValidator, clearProperties);
373  PHP_METHOD(SchemaValidator, exceptionClear);
374  PHP_METHOD(SchemaValidator, exceptionOccurred);
375  PHP_METHOD(SchemaValidator, getErrorCode);
376  PHP_METHOD(SchemaValidator, getErrorMessage);
377 
378 
379 /* ============== PHP Interface of XdmValue =============== */
380 
381  PHP_METHOD(XdmValue, __construct);
382  PHP_METHOD(XdmValue, __destruct);
383  PHP_METHOD(XdmValue, __toString);
384  PHP_METHOD(XdmValue, getHead);
385  PHP_METHOD(XdmValue, itemAt);
386  PHP_METHOD(XdmValue, size);
387  PHP_METHOD(XdmValue, addXdmItem);
388 
389 
390 /* ============== PHP Interface of XdmItem =============== */
391 
392  PHP_METHOD(XdmItem, __construct);
393  PHP_METHOD(XdmItem, __destruct);
394  PHP_METHOD(XdmItem, __toString);
395  PHP_METHOD(XdmItem, getStringValue);
396  PHP_METHOD(XdmItem, isAtomic);
397  PHP_METHOD(XdmItem, isNode);
398  PHP_METHOD(XdmItem, getAtomicValue);
399  PHP_METHOD(XdmItem, getNodeValue);
400 
401 /* ============== PHP Interface of XdmNode =============== */
402 
403  PHP_METHOD(XdmNode, __construct);
404  PHP_METHOD(XdmNode, __destruct);
405  PHP_METHOD(XdmNode, __toString);
406  PHP_METHOD(XdmNode, getBaseURI);
407  PHP_METHOD(XdmNode, getStringValue);
408  PHP_METHOD(XdmNode, getNodeKind);
409  PHP_METHOD(XdmNode, getLocalName);
410  PHP_METHOD(XdmNode, getNodeName);
411  PHP_METHOD(XdmNode, isAtomic);
412  PHP_METHOD(XdmNode, getChildCount);
413  PHP_METHOD(XdmNode, getAttributeCount);
414  PHP_METHOD(XdmNode, getChildNode);
415  PHP_METHOD(XdmNode, getParent);
416  PHP_METHOD(XdmNode, getAttributeNode);
417  PHP_METHOD(XdmNode, getAttributeValue);
418  PHP_METHOD(XdmNode, getTypedValue);
419 
420 
421 /* ============== PHP Interface of XdmAtomicValue =============== */
422 
423  PHP_METHOD(XdmAtomicValue, __construct);
424  PHP_METHOD(XdmAtomicValue, __destruct);
425  PHP_METHOD(XdmAtomicValue, __toString);
426  PHP_METHOD(XdmAtomicValue, getStringValue);
427  PHP_METHOD(XdmAtomicValue, getBooleanValue);
428  PHP_METHOD(XdmAtomicValue, getDoubleValue);
429  PHP_METHOD(XdmAtomicValue, getLongValue);
430  PHP_METHOD(XdmAtomicValue, getPrimitiveTypeName);
431  PHP_METHOD(XdmAtomicValue, isAtomic);
432 
433 
434 
435  /* ============== PHP Interface of XdmFunctionItem =============== */
436  PHP_METHOD(XdmFunctionItem, __construct);
437  PHP_METHOD(XdmFunctionItem, __destruct);
438  PHP_METHOD(XdmFunctionItem, getName);
439  PHP_METHOD(XdmFunctionItem, getArity);
440  PHP_METHOD(XdmFunctionItem, getSystemFunction);
441  PHP_METHOD(XdmFunctionItem, call);
442 
443 
444 
445 
446  /* ============== PHP Interface of XdmMap =============== */
447 
448  PHP_METHOD(XdmMap, __construct);
449  PHP_METHOD(XdmMap, __destruct);
450  PHP_METHOD(XdmMap, mapSize);
451  PHP_METHOD(XdmMap, get);
452  PHP_METHOD(XdmMap, put);
453  PHP_METHOD(XdmMap, remove);
454  PHP_METHOD(XdmMap, isEmpty);
455  PHP_METHOD(XdmMap, containsKey);
456  PHP_METHOD(XdmMap, keys);
457  // PHP_METHOD(XdmMap, asMap);
458  // PHP_METHOD(XdmMap, values);
459 
460 
461 
462 
463  /* ============== PHP Interface of XdmArray =============== */
464 
465  PHP_METHOD(XdmArray, __construct);
466  PHP_METHOD(XdmArray, __destruct);
467  PHP_METHOD(XdmArray, get);
468  PHP_METHOD(XdmArray, put);
469  PHP_METHOD(XdmArray, addMember);
470  PHP_METHOD(XdmArray, concat);
471  //PHP_METHOD(XdmArray, values);
472  PHP_METHOD(XdmArray, getArity);
473  PHP_METHOD(XdmArray, arrayLength);
474 
475 
476 #endif /* PHP_SAXON_H */
477 
478 
479 
480 
481 
482 
483 
484 
485 
486 
487 
488 
489 
490 
491 
492 
493 
494 
Definition: DocumentBuilder.h:33
The SaxonProcessor class acts as a factory for generating XQuery, XPath, Schema and XSLT compilers.
Definition: SaxonProcessor.h:119
Definition: SchemaValidator.h:24
Definition: XPathProcessor.h:27
Definition: XQueryProcessor.h:26
Definition: XdmArray.h:25
Definition: XdmAtomicValue.h:26
Definition: XdmFunctionItem.h:23
Definition: XdmItem.h:29
Definition: XdmMap.h:29
Definition: XdmNode.h:31
Definition: XdmValue.h:50
Definition: Xslt30Processor.h:26
Definition: XsltExecutable.h:30
Definition: php7_saxon.h:98
Definition: php5_saxon.h:58
Definition: php5_saxon.h:78
Definition: php7_saxon.h:161
Definition: php5_saxon.h:98
Definition: php7_saxon.h:147
Definition: php5_saxon.h:88
Definition: php7_saxon.h:154
Definition: php5_saxon.h:93
Definition: php5_saxon.h:83
Definition: php5_saxon.h:73
Definition: php5_saxon.h:68
Definition: php5_saxon.h:63
Definition: php7_saxon.h:173
Definition: php5_saxon.h:54