This source file includes following definitions.
- spl_instantiate_arg_ex1
- spl_instantiate_arg_ex2
- spl_instantiate_arg_n
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #ifndef SPL_ENGINE_H
22 #define SPL_ENGINE_H
23
24 #include "php.h"
25 #include "php_spl.h"
26 #include "zend_interfaces.h"
27
28 PHPAPI void spl_instantiate(zend_class_entry *pce, zval **object, int alloc TSRMLS_DC);
29
30 PHPAPI long spl_offset_convert_to_long(zval *offset TSRMLS_DC);
31
32
33 static inline int spl_instantiate_arg_ex1(zend_class_entry *pce, zval **retval, int alloc, zval *arg1 TSRMLS_DC)
34 {
35 spl_instantiate(pce, retval, alloc TSRMLS_CC);
36
37 zend_call_method(retval, pce, &pce->constructor, pce->constructor->common.function_name, strlen(pce->constructor->common.function_name), NULL, 1, arg1, NULL TSRMLS_CC);
38 return 0;
39 }
40
41
42
43 static inline int spl_instantiate_arg_ex2(zend_class_entry *pce, zval **retval, int alloc, zval *arg1, zval *arg2 TSRMLS_DC)
44 {
45 spl_instantiate(pce, retval, alloc TSRMLS_CC);
46
47 zend_call_method(retval, pce, &pce->constructor, pce->constructor->common.function_name, strlen(pce->constructor->common.function_name), NULL, 2, arg1, arg2 TSRMLS_CC);
48 return 0;
49 }
50
51
52
53 static inline void spl_instantiate_arg_n(zend_class_entry *pce, zval **retval, int argc, zval ***argv TSRMLS_DC)
54 {
55 zend_function *func = pce->constructor;
56 zend_fcall_info fci;
57 zend_fcall_info_cache fcc;
58 zval *dummy;
59 zval z_name;
60
61 spl_instantiate(pce, retval, 0 TSRMLS_CC);
62
63 ZVAL_STRING(&z_name, func->common.function_name, 0);
64
65 fci.size = sizeof(zend_fcall_info);
66 fci.function_table = &pce->function_table;
67 fci.function_name = &z_name;
68 fci.object_ptr = *retval;
69 fci.symbol_table = NULL;
70 fci.retval_ptr_ptr = &dummy;
71 fci.param_count = argc;
72 fci.params = argv;
73 fci.no_separation = 1;
74
75 fcc.initialized = 1;
76 fcc.function_handler = func;
77 fcc.calling_scope = EG(scope);
78 fcc.called_scope = pce;
79 fcc.object_ptr = *retval;
80
81 zend_call_function(&fci, &fcc TSRMLS_CC);
82
83 zval_ptr_dtor(&dummy);
84 }
85
86
87 #endif
88
89
90
91
92
93
94
95
96