Project

Profile

Help

Download (12.9 KB) Statistics
| Branch: | Revision:

he / src / main / c / Saxon.C.API / php_saxon.h @ 339c45ee

1 72bf04c6 Norman Walsh
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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 xslt30Processor_object {
100
101
    Xslt30Processor *xslt30Processor;
102
    zend_object std;
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
147
#define PHP_SAXON_EXTNAME  "saxonc"
148
#define PHP_SAXON_EXTVER   "1.2.0"
149
150
/*
151
 * Class:     com_saxonica_functions_extfn_PhpCall_PhpFunctionCall
152
 * Method:    _phpCall
153
 * Signature: ([Ljava/lang/String;[Ljava/lang/String;)Ljava/lang/Object;
154
 */
155
156
jobject JNICALL phpNativeCall
157
  (JNIEnv *env, jobject object, jstring funcName, jobjectArray arguments, jobjectArray arrayTypes);
158
        
159
        PHP_MSHUTDOWN_FUNCTION(saxon);
160
        PHP_MINFO_FUNCTION(saxon);
161
        PHP_MINIT_FUNCTION(saxon);
162
PHP_RINIT_FUNCTION(saxon);
163
164
    PHP_METHOD(SaxonProcessor,  __construct);
165
    PHP_METHOD(SaxonProcessor,  __destruct);
166
167
    PHP_METHOD(SaxonProcessor,  createAtomicValue);
168
    PHP_METHOD(SaxonProcessor,  parseXmlFromString);
169
    PHP_METHOD(SaxonProcessor,  parseXmlFromFile);
170
    PHP_METHOD(SaxonProcessor,  setcwd);
171
//    PHP_METHOD(SaxonProcessor,  importDocument);
172
    PHP_METHOD(SaxonProcessor,  setResourcesDirectory);
173
    PHP_METHOD(SaxonProcessor,  setCatalog);
174
    PHP_METHOD(SaxonProcessor,  registerPHPFunctions);
175
 //   PHP_METHOD(SaxonProcessor,  getXslMessages);
176
    PHP_METHOD(SaxonProcessor, setConfigurationProperty);
177
    PHP_METHOD(SaxonProcessor, newXsltProcessor);
178
    PHP_METHOD(SaxonProcessor, newXslt30Processor);
179
    PHP_METHOD(SaxonProcessor, newXQueryProcessor);
180
    PHP_METHOD(SaxonProcessor, newXPathProcessor);
181
    PHP_METHOD(SaxonProcessor, newSchemaValidator);
182
    PHP_METHOD(SaxonProcessor,  version);
183
    PHP_METHOD(SaxonProcessor,  isSchemaAware);
184
    PHP_METHOD(SaxonProcessor,  release);
185
186
187
188
189
    //PHP_METHOD(XsltProcessor,  __construct);
190
    PHP_METHOD(XsltProcessor,  __destruct);
191
    PHP_METHOD(XsltProcessor,  transformFileToFile);
192
    PHP_METHOD(XsltProcessor,  transformFileToString);
193
    PHP_METHOD(XsltProcessor,  transformFileToValue);
194
    PHP_METHOD(XsltProcessor,  transformToString);
195
    PHP_METHOD(XsltProcessor,  transformToValue);
196
    PHP_METHOD(XsltProcessor,  transformToFile);
197
    PHP_METHOD(XsltProcessor, compileFromFile);
198
    PHP_METHOD(XsltProcessor, compileFromValue);
199
    PHP_METHOD(XsltProcessor, compileFromString);
200
    PHP_METHOD(XsltProcessor, compileFromStringAndSave);
201
    PHP_METHOD(XsltProcessor, compileFromFileAndSave);
202
    PHP_METHOD(XsltProcessor,  setOutputFile);
203
    PHP_METHOD(XsltProcessor, setBaseOutputURI);
204
    PHP_METHOD(XsltProcessor,  setSourceFromFile);
205
    PHP_METHOD(XsltProcessor,  setSourceFromXdmValue);
206
    PHP_METHOD(XsltProcessor,  setJustInTimeCompilation);
207
    PHP_METHOD(XsltProcessor,  setParameter);
208
    PHP_METHOD(XsltProcessor,  setProperty);
209
    PHP_METHOD(XsltProcessor,  clearParameters);
210
    PHP_METHOD(XsltProcessor,  clearProperties);
211
    PHP_METHOD(XsltProcessor,  exceptionClear);
212
    PHP_METHOD(XsltProcessor,  exceptionOccurred);
213
    PHP_METHOD(XsltProcessor,  getErrorCode);
214
    PHP_METHOD(XsltProcessor,  getErrorMessage);
215
    PHP_METHOD(XsltProcessor,  getExceptionCount);
216
    PHP_METHOD(XsltProcessor,  setupXslMessage);
217
218
219
    PHP_METHOD(Xslt30Processor,  __destruct);
220
    PHP_METHOD(Xslt30Processor, callFunctionReturningValue);
221
    PHP_METHOD(Xslt30Processor, callFunctionReturningString);
222
    PHP_METHOD(Xslt30Processor, callFunctionReturningFile);
223
    PHP_METHOD(Xslt30Processor, callTemplateReturningValue);
224
    PHP_METHOD(Xslt30Processor, callTemplateReturningString);
225
    PHP_METHOD(Xslt30Processor, callTemplateReturningFile);
226
    PHP_METHOD(Xslt30Processor, applyTemplatesReturningValue);
227
    PHP_METHOD(Xslt30Processor, applyTemplatesReturningString);
228
    PHP_METHOD(Xslt30Processor, applyTemplatesReturningFile);
229
    PHP_METHOD(Xslt30Processor, setBaseOutputURI);
230
    PHP_METHOD(Xslt30Processor, setInitialTemplateParameters);
231
    PHP_METHOD(Xslt30Processor, setInitialMatchSelection);
232
    PHP_METHOD(Xslt30Processor, setInitialMatchSelectionAsFile);
233
    PHP_METHOD(Xslt30Processor, setGlobalContextItem);
234
    PHP_METHOD(Xslt30Processor, setGlobalContextFromFile);
235
    PHP_METHOD(Xslt30Processor,  transformFileToFile);
236
    PHP_METHOD(Xslt30Processor,  transformFileToString);
237
    PHP_METHOD(Xslt30Processor,  transformFileToValue);
238
    PHP_METHOD(Xslt30Processor,  transformToString);
239
    PHP_METHOD(Xslt30Processor,  transformToValue);
240
    PHP_METHOD(Xslt30Processor,  transformToFile);
241
    PHP_METHOD(Xslt30Processor, compileFromFile);
242
    PHP_METHOD(Xslt30Processor, compileFromValue);
243
    PHP_METHOD(Xslt30Processor, compileFromString);
244
    PHP_METHOD(Xslt30Processor, compileFromStringAndSave);
245
    PHP_METHOD(Xslt30Processor, compileFromFileAndSave);
246
    PHP_METHOD(Xslt30Processor, compileFromAssociatedFile);
247
    PHP_METHOD(Xslt30Processor,  setOutputFile);
248
    PHP_METHOD(Xslt30Processor,  setJustInTimeCompilation);
249
    PHP_METHOD(Xslt30Processor,  setResultAsRawValue);
250
    PHP_METHOD(Xslt30Processor,  setParameter);
251
    PHP_METHOD(Xslt30Processor,  setProperty);
252
    PHP_METHOD(Xslt30Processor,  clearParameters);
253
    PHP_METHOD(Xslt30Processor,  clearProperties);
254
    PHP_METHOD(Xslt30Processor,  exceptionClear);
255
    PHP_METHOD(Xslt30Processor,  exceptionOccurred);
256
    PHP_METHOD(Xslt30Processor,  getErrorCode);
257
    PHP_METHOD(Xslt30Processor,  getErrorMessage);
258
    PHP_METHOD(Xslt30Processor,  getExceptionCount);
259
    PHP_METHOD(Xslt30Processor,  setupXslMessage);
260
261
262
263
   // PHP_METHOD(XQueryProcesor,  __construct);
264
    PHP_METHOD(XQueryProcesor,  __destruct);
265
    PHP_METHOD(XQueryProcessor,  setQueryContent);
266
    PHP_METHOD(XQueryProcessor,  setContextItem);
267
    PHP_METHOD(XQueryProcessor,  setContextItemFromFile);
268
    PHP_METHOD(XQueryProcessor,  setParameter);
269
    PHP_METHOD(XQueryProcessor,  setProperty);
270
    PHP_METHOD(XQueryProcessor,  clearParameters);
271
    PHP_METHOD(XQueryProcessor,  clearProperties);
272
   // PHP_METHOD(XQueryProcessor, setOutputFile);
273
    PHP_METHOD(XQueryProcessor, runQueryToValue);
274
    PHP_METHOD(XQueryProcessor, runQueryToString);
275
    PHP_METHOD(XQueryProcessor, runQueryToFile);
276
    PHP_METHOD(XQueryProcessor, setQueryFile);
277
    PHP_METHOD(XQueryProcessor, setQueryBaseURI);
278
    PHP_METHOD(XQueryProcessor, declareNamespace);
279
    PHP_METHOD(XQueryProcessor,  exceptionClear);
280
    PHP_METHOD(XQueryProcessor,  exceptionOccurred);
281
    PHP_METHOD(XQueryProcessor,  getErrorCode);
282
    PHP_METHOD(XQueryProcessor,  getErrorMessage);
283
    PHP_METHOD(XQueryProcessor,  getExceptionCount);
284
285
   // PHP_METHOD(XPathProcessor,  __construct);
286
    PHP_METHOD(XPathProcessor,  __destruct);
287
    PHP_METHOD(XPathProcessor,  setContextItem);
288
    PHP_METHOD(XPathProcessor,  setContextFile);
289
    PHP_METHOD(XQueryProcessor, setBaseURI);
290
    PHP_METHOD(XPathProcessor,  effectiveBooleanValue);
291
    PHP_METHOD(XPathProcessor,  evaluate);
292
    PHP_METHOD(XPathProcessor,  evaluateSingle);
293
    PHP_METHOD(XPathProcessor, declareNamespace);
294
    PHP_METHOD(XPathProcessor, setBackwardsCompatible);
295
    PHP_METHOD(XPathProcessor, setCaching);
296
    PHP_METHOD(XPathProcessor, importSchemaNamespace);
297
    PHP_METHOD(XPathProcessor,  setParameter);
298
    PHP_METHOD(XPathProcessor,  setProperty);
299
    PHP_METHOD(XPathProcessor,  clearParameters);
300
    PHP_METHOD(XPathProcessor,  clearProperties);
301
    PHP_METHOD(XPathProcessor,  exceptionClear);
302
    PHP_METHOD(XPathProcessor,  exceptionOccurred);
303
    PHP_METHOD(XPathProcessor,  getErrorCode);
304
    PHP_METHOD(XPathProcessor,  getErrorMessage);
305
    PHP_METHOD(XPathProcessor,  getExceptionCount);
306
307
308
   // PHP_METHOD(SchemaValidator,  __construct);
309
    PHP_METHOD(SchemaValidator,  __destruct);
310
    PHP_METHOD(SchemaValidator,  setSourceNode);
311
    PHP_METHOD(SchemaValidator,  setOutputFile);
312
    PHP_METHOD(SchemaValidator,  exportSchema);
313
    PHP_METHOD(SchemaValidator, registerSchemaFromFile);
314
    PHP_METHOD(SchemaValidator, registerSchemaFromString);
315
    PHP_METHOD(SchemaValidator, validate); 
316
    PHP_METHOD(SchemaValidator, validateToNode);
317
    PHP_METHOD(SchemaValidator, getValidationReport);
318
    PHP_METHOD(SchemaValidator,  setParameter);
319
    PHP_METHOD(SchemaValidator,  setProperty);
320
    PHP_METHOD(SchemaValidator,  clearParameters);
321
    PHP_METHOD(SchemaValidator,  clearProperties);
322
    PHP_METHOD(SchemaValidator,  exceptionClear);
323
    PHP_METHOD(SchemaValidator,  exceptionOccurred);
324
    PHP_METHOD(SchemaValidator,  getErrorCode);
325
    PHP_METHOD(SchemaValidator,  getErrorMessage);
326
    PHP_METHOD(SchemaValidator,  getExceptionCount); 
327
        
328
329
/*     ============== PHP Interface of   XdmValue =============== */
330
331
    PHP_METHOD(XdmValue,  __construct);
332
    PHP_METHOD(XdmValue,  __destruct);
333
    PHP_METHOD(XdmValue,  __toString);
334
    PHP_METHOD(XdmValue,  getHead);
335
    PHP_METHOD(XdmValue,  itemAt);
336
    PHP_METHOD(XdmValue,  size);
337
    PHP_METHOD(XdmValue, addXdmItem);
338
339
340
/*     ============== PHP Interface of   XdmItem =============== */
341
342
    PHP_METHOD(XdmItem,  __construct);
343
    PHP_METHOD(XdmItem,  __destruct);
344
    PHP_METHOD(XdmItem,  __toString);
345
    PHP_METHOD(XdmItem,  getStringValue);
346
    PHP_METHOD(XdmItem,  isAtomic);
347
    PHP_METHOD(XdmItem,  isNode);
348
    PHP_METHOD(XdmItem,  getAtomicValue);
349
    PHP_METHOD(XdmItem,  getNodeValue);        
350
351
/*     ============== PHP Interface of   XdmNode =============== */
352
353
    PHP_METHOD(XdmNode,  __construct);
354
    PHP_METHOD(XdmNode,  __destruct);
355
    PHP_METHOD(XdmNode,  __toString);
356
    PHP_METHOD(XdmNode,  getStringValue);
357
    PHP_METHOD(XdmNode, getNodeKind);
358
    PHP_METHOD(XdmNode, getNodeName);
359
    PHP_METHOD(XdmNode,  isAtomic);
360
    PHP_METHOD(XdmNode,  getChildCount);   
361
    PHP_METHOD(XdmNode,  getAttributeCount); 
362
    PHP_METHOD(XdmNode,  getChildNode);
363
    PHP_METHOD(XdmNode,  getParent);
364
    PHP_METHOD(XdmNode,  getAttributeNode);
365
    PHP_METHOD(XdmNode,  getAttributeValue);
366
    PHP_METHOD(XdmNode,  getTypedValue);
367
    
368
369
/*     ============== PHP Interface of   XdmAtomicValue =============== */
370
371
    PHP_METHOD(XdmAtomicValue,  __construct);
372
    PHP_METHOD(XdmAtomicValue,  __destruct);
373
    PHP_METHOD(XdmAtomicValue,  __toString);
374
    PHP_METHOD(XdmAtomicValue,  getStringValue);
375
    PHP_METHOD(XdmAtomicValue,  getBooleanValue);
376
    PHP_METHOD(XdmAtomicValue,  getDoubleValue);
377
    PHP_METHOD(XdmAtomicValue,  getLongValue);
378
    PHP_METHOD(XdmAtomicValue,  getPrimitiveTypeName);
379
    PHP_METHOD(XdmAtomicValue,  isAtomic);
380
381
382
#endif /* PHP_SAXON_H */
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398