blob: 760df5c171fbf44fcb303713a8384c77f75d9b1e (
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
|
/**
* ClassInfo.cpp
*
* Implementation for the class info
*
* @documentation private
*/
#include "includes.h"
/**
* Set up namespace
*/
namespace Php {
/**
* Function that is called by the Zend engine every time that a function gets called
* @param ht
* @param return_value
* @param return_value_ptr
* @param this_ptr
* @param return_value_used
* @param tsrm_ls
* @return integer
*/
void invoke_method(INTERNAL_FUNCTION_PARAMETERS)
{
std::cout << "invoke method" << std::endl;
return;
// find the function name
const char *name = get_active_function_name(TSRMLS_C);
// uncover the hidden pointer inside the function name
Function *function = HiddenPointer<Function>(name);
// wrap the return value
Value result(return_value, true);
// construct parameters
Parameters params(ZEND_NUM_ARGS());
// get the result
result = function->invoke(*PHPCPP_G(environment), params);
}
/**
* Helper struct to create an internal method
*/
/**
* Initialize the class
* @param mixed Optional threading ID
*/
void _ClassInfo::initialize(TSRMLS_D)
{
// the class entry
zend_class_entry entry;
// initialize the class entry
INIT_CLASS_ENTRY_EX(entry, _name.c_str(), _name.size(), NULL);
// functions we need
// @todo should not be static
static InternalFunction constructor(invoke_method, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC);
// we need a special constructor
entry.__call = constructor;
// register the class
_entry = zend_register_internal_class(&entry TSRMLS_CC);
}
/**
* End of namespace
*/
}
|