-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathguiProperties.pas
168 lines (134 loc) · 4.07 KB
/
guiProperties.pas
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
unit guiProperties;
{$ifdef fpc}
{$mode delphi}{$H+}
{$endif}
interface
uses
Classes, SysUtils,
zendTypes,
ZENDAPI,
phpTypes,
PHPAPI,
phpUtils,
php4delphi,
propertiesEngine;
procedure InitializeGuiProperties(PHPEngine: TPHPEngine);
procedure regConstant();
procedure gui_propGet(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
procedure gui_propType(ht: integer; return_value: pzval;
return_value_ptr: pzval; this_ptr: pzval; return_value_used: integer;
TSRMLS_DC: pointer); cdecl;
procedure gui_propExists(ht: integer; return_value: pzval;
return_value_ptr: pzval; this_ptr: pzval; return_value_used: integer;
TSRMLS_DC: pointer); cdecl;
procedure gui_propList(ht: integer; return_value: pzval;
return_value_ptr: pzval; this_ptr: pzval; return_value_used: integer;
TSRMLS_DC: pointer); cdecl;
procedure gui_propSet(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
implementation
procedure regConstant();
begin
regConstList(['tkUnknown', 'tkInteger', 'tkChar', 'tkEnumeration', 'tkFloat',
'tkSet', 'tkMethod', 'tkSString', 'tkLString', 'tkAString',
'tkWString', 'tkVariant', 'tkArray', 'tkRecord', 'tkInterface',
'tkClass', 'tkObject', 'tkWChar', 'tkBool', 'tkInt64', 'tkQWord',
'tkDynArray', 'tkInterfaceRaw', 'tkProcVar', 'tkUString', 'tkUChar']);
end;
procedure gui_propGet;
var
p: pzval_array;
begin
if ht < 2 then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
variant2zval(getProperty(Z_LVAL(p[0]^), Z_STRVAL(p[1]^)), return_value);
dispose_pzval_array(p);
{
if not checkPrs(ht,2,TSRMLS_DC) then exit; if not checkPrs2(ht,p,TSRMLS_DC) then exit;
readPrs(p, ht);
variant2zval(getProperty(prs[0],prs[1]), return_value);
dispose_pzval_array(p); }
end;
procedure gui_propType;
var
p: pzval_array;
begin
if ht < 2 then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
ZVAL_LONG(return_value, getPropertyType(Z_LVAL(p[0]^), Z_STRVAL(p[1]^)));
dispose_pzval_array(p);
{
if not checkPrs(ht,2,TSRMLS_DC) then exit; if not checkPrs2(ht,p,TSRMLS_DC) then exit;
readPrs(p, ht);
variant2zval(getPropertyType(prs[0],prs[1]), return_value);
dispose_pzval_array(p); }
end;
procedure gui_propExists;
var
p: pzval_array;
begin
if ht < 2 then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
ZVAL_BOOL(return_value, existProperty(Z_LVAL(p[0]^), Z_STRVAL(p[1]^)));
dispose_pzval_array(p);
{
if not checkPrs(ht,2,TSRMLS_DC) then exit; if not checkPrs2(ht,p,TSRMLS_DC) then exit;
readPrs(p, ht);
variant2zval(existProperty(prs[0],prs[1]), return_value);
dispose_pzval_array(p); }
end;
procedure gui_propList;
var
p: pzval_array;
begin
if ht < 2 then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
ZVAL_STRING(return_value, PAnsiChar(getProperties(Z_LVAL(p[0]^))), True);
dispose_pzval_array(p);
{
if not checkPrs(ht,1,TSRMLS_DC) then exit; if not checkPrs2(ht,p,TSRMLS_DC) then exit;
readPrs(p, ht);
variant2zval(getProperties(prs[0]), return_value);
dispose_pzval_array(p); }
end;
procedure gui_propSet;
var
p: pzval_array;
begin
if ht < 3 then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
if p[2]^^._type in [IS_LONG, IS_BOOL, IS_DOUBLE, IS_STRING] then
ZVAL_BOOL(return_value, setProperty(Z_LVAL(p[0]^), Z_STRVAL(p[1]^),
zval2variant(p[2]^^)));
dispose_pzval_array(p);
end;
procedure InitializeGuiProperties(PHPEngine: TPHPEngine);
begin
PHPEngine.AddFunction('gui_propGet', @gui_propGet);
PHPEngine.AddFunction('gui_propType', @gui_propType);
PHPEngine.AddFunction('gui_propExists', @gui_propExists);
PHPEngine.AddFunction('gui_propList', @gui_propList);
PHPEngine.AddFunction('gui_propSet', @gui_propSet);
end;
end.