forked from dim-s/soulengine
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathguiProperties.pas
802 lines (725 loc) · 23.4 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
unit guiProperties;
{$I PHP.inc}
{$ifdef fpc}
{$mode delphi}{$H+}
{$endif}
interface
uses
Classes,
SysUtils,
zendTypes,
Variants,
ZENDAPI,
PHPAPI,
php4delphi,
propertiesEngine,
Dialogs,
Controls,
RTTI;
procedure InitializeGuiProperties(PHPEngine: TPHPEngine);
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_class_propList(ht: integer; return_value: pzval;
return_value_ptr: pzval; this_ptr: pzval; return_value_used: integer;
TSRMLS_DC: pointer); cdecl;
//Ïîëó÷åíèå ñïèñêà ñâîéñòâ êëàññà
procedure gui_class_propArray(ht: integer; return_value: pzval;
return_value_ptr: pzval; this_ptr: pzval; return_value_used: integer;
TSRMLS_DC: pointer); cdecl;
procedure gui_get_recordInfo(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;
//Çàäàíèå/óñòàíîâêà çíà÷åíèÿ ñâîéñòâà
procedure gui_methodList(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
//Ïîëó÷åíèå ñïèñêà ìåòîäîâ
procedure gui_methodExists(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
//Ïðîâåðêà ìåòîäà íà ñóùåñòâîâàíèå
procedure gui_class_method_exist
(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
//Ïðîâåðêà ìåòîäà íà ñóùåñòâîâàíèå (äëÿ êëàññîâ)
procedure gui_methodCall(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
//Âûçîâ ìåòîäà
procedure gui_methodrtype(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
//Ïðîâåðêà âîçâðàùàåìîãî çíà÷åíèÿ ìåòîäà
procedure gui_get_evt_paramss(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
//Ïîëó÷åíèå ñïèñêà ïàðàìåòðîâ (ñòðîêè) äëÿ ïîäñêàçîê
procedure gui_get_evt_paramnames(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
//Ïîëó÷åíèå ñïèñêà íàçâàíèé ïàðàìåòðîâ
procedure gui_get_evt_paramtypes(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
//Ïîëó÷åíèå ñïèñêà òèïîâ ïàðàìåòðîâ (â ñòèëå äåëôè)
procedure gui_get_evt_assci(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
//Ïîëó÷åíèå àññîöèàòèâíîãî ñïèñêà ïàðàìåòðîâ, ãäå êëþ÷ - íàçâàíèå, à çíà÷åíèå - òèï ïàðàìåòðà
procedure gui_class_methodList(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
//Ïîëó÷åíèå ñïèñêà ìåòîäîâ êëàññà
procedure gui_get_method_params(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
//Ïîëó÷åíèå ñïèñêà àðãóìåíòîâ ìåòîäà êëàññà
procedure gui_method_params(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
//Ïîëó÷åíèå ñòðîêè ïàðàìåòðîâ ìåòîäà êëàññà
procedure gui_get_all_unitsclasses(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
//Ïîëó÷åíèå ñïèñêà âñåõ êëàññîâ
procedure rtl(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
//Ïîëó÷åíèå/çàãðóçêà bpl/dll-áèáëèîòåêè
procedure rtll(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
//Ïðîâåðÿåò çàãðóæåíà ëè áèáëèîòåêà.
procedure gpreadable(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
procedure gpwritable(ht: integer; return_value: pzval; return_value_ptr: pzval;
this_ptr: pzval; return_value_used: integer; TSRMLS_DC: pointer); cdecl;
implementation
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);//Ïîëó÷åíèå ïàðàìåòðîâ ôóíêöèåé äèì-ñà
{$IFDEF PHP7}
if(p[1]^.u1.v._type = IS_STRING) THEN
{$ELSE}
if(p[1]^._type = IS_STRING) THEN //Åñëè òèï âòîðîãî àðãóìåíòà/ïàðàìåòðà - ñòðîêà, òî
{$ENDIF}
begin
//Âûçûâàåì ôóíêöèþ ïîëó÷åíèÿ çíà÷åíèÿ ñâîéñòâà è âîçâðàùàåì ðåçóëüòàò
VariantToZend(getProperty(integer(Z_LVAL(p[0]^)),Z_STRVAL(p[1]^)), return_value);
end;
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);
//Âîçâðàùàåì â õýø-ìàññèâ return_value òèï/âèä ïàðàìåòðà/ñâîéñòâà îáúåêòà
ZVALVAL(return_value, getPropertyType(Z_LVAL(p[0]^), Z_STRVAL(p[1]^)));
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);
//Ïðîâåðÿåì ñâîéñòâî íà ñóùåñòâîâàíèå,
//Âîçðàùàåì áóëåâî ÷èñëî = 0 u 1
ZVALVAL(return_value, existProperty(Z_LVAL(p[0]^), Z_STRVAL(p[1]^)));
dispose_pzval_array(p);
end;
procedure gui_methodExists;
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);
//Ïðîâåðÿåì ìåòîä íà ñóùåñòâîâàíèå,
//Âîçðàùàåì áóëåâî ÷èñëî = 0 u 1
ZVALVAL(return_value, existMethod(Z_LVAL(p[0]^), Z_STRVAL(p[1]^)));
dispose_pzval_array(p);
end;
procedure zval_TVALUE(v: TValue; p: pzval);
begin
case v.Kind of
tkUnknown:
ZVALVAL(p);
tkInteger:
ZVALVAL(p, v.AsInteger);
tkInt64:
ZVALVAL(p, integer(v.AsInt64));
tkEnumeration:
ZVALVAL(p, v.AsOrdinal);
tkWChar:
ZVAL_STRINGW(p, PWideChar(v.AsType<WideChar>), true);
tkChar:
ZVAL_STRING(p, zend_pchar(zend_ustr(v.AsType<AnsiChar>)), true);
tkFloat:
ZVAL_STRINGW(p, PWideChar(v.AsExtended.ToString), true);
tkString:
ZVAL_STRINGW(p, PChar(String(v.AsType<ShortString>)), true);
tkClass:
ZVALVAL(p, integer( v.AsObject ));
tkUString:
ZVAL_STRING(p, zend_pchar(zend_ustr(v.AsType<UnicodeString>)), true );
tkPointer:
ZVALVAL(p, integer( v.AsType<Pointer> ));
tkAnsiString:
ZVAL_STRING(p, zend_pchar(zend_ustr(v.AsType<AnsiString>)), true);
tkWString:
ZVAL_STRINGW(p, PChar(v.AsType<WideString>), true);
tkVariant:
VariantToZend(v.AsVariant, p)
else
ZVALVAL(p);
end;
end;
procedure gui_methodrtype;
label ex1;
var p: pzval_array;
ctx : TRttiContext;
lType : TRttiType;
lMethod : TRttiMethod;
c : TObject;
begin
if (ht < 2) and (ht > 3) then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
ctx := TRttiContext.Create;
ZVALVAL(return_value, -1);
{$IFDEF PHP7}
if p[0]^^.u1.v._type = IS_LONG then
{$ELSE}
if p[0]^^._type = IS_LONG then
{$ENDIF}
begin
c := TObject(integer(Z_LVAL(p[0]^)));
if not Assigned(c) then goto ex1;
lType:=ctx.GetType(c.ClassInfo);
end else begin
if Assigned(FindClass(Z_STRVAL(p[0]^)) ) then
lType:=ctx.GetType(FindClass(Z_STRVAL(p[0]^)))
else goto ex1;
end;
if not Assigned(lType) then goto ex1;
if Assigned(lType) then
begin
lMethod:=lType.GetMethod( Z_STRVAL(p[1]^) );
if Assigned(lMethod) then
if Assigned(lMethod.ReturnType) then
if ht = 3 then begin
if Z_BVAL(p[2]^) then
begin
case lMethod.ReturnType.TypeKind of
tkClass:
ZVAL_STRINGW(return_value, PChar(lMethod.ReturnType.ToString), false);
tkClassRef:
ZVAL_STRINGW(return_value, PChar(lMethod.ReturnType.ToString), false);
tkSet:
ZVAL_STRINGW(return_value, PChar(lMethod.ReturnType.AsSet.ElementType.ToString),false);
tkEnumeration:
ZVAL_STRINGW(return_value, PChar(lMethod.ReturnType.AsOrdinal.ToString), false);
end;
end
else
ZVALVAL(return_value, integer(lMethod.ReturnType.TypeKind));
end else
ZVALVAL(return_value, integer(lMethod.ReturnType.TypeKind));
end else goto ex1;
ex1:
dispose_pzval_array(p);//íå çàáûâàåì îñâîáîæäàòü ïàìÿòü, èíà÷å çàáü¸òñà
Exit;
end;
procedure gui_methodCall;
label ex1;
var
p: pzval_array; //õýø-ìàññèâ ïåðåäàâàåìûõ ïàðàìåòðîâ
ar: TArrayVariant; //õýø-ìàññèâ äëÿ ïåðåäàííîãî ìàññèâà
arr: array of TValue; //ìàññèâ, íóæíûé äëÿ âûçîâà ìåòîäà è ïåðåäà÷è åìó àðãóìåíòîâ
// x: variant; //íåêèé âàðèàíò(ïåðåìåííàÿ ëþáîãî òèïà)
params: TArray<Rtti.TRttiParameter>;//òèïû ïåðåäàâàåìûõ ïàðàìåòðîâ (íóæíî äëÿ ïðîâåðêè ïåðåä ïåðåäà÷åé)
I, L: integer; //÷èñëî äëÿ èòåðèðîâàíèÿ â ìàññèâå âñåõ àðãóìåíòîâ
xp: Rtti.TRttiParameter;
// method: ^TNotifyEvent;//ñîáñòâåííî, ñàì ìåòîä
//
ctx : TRttiContext;
lType : TRttiType;
lMethod : TRttiMethod;
c : TObject;
ClassOfP: TClass;
begin
if (ht < 2) or (ht > 3) then //êîñòûëü, ïîòîìó-÷òî â äåëüôèéñêîì Switch-Case íåòó Default:
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
{if Assigned(TObject(Z_STRVAL(p[0]^))) and (Z_STRVAL(p[1]^) <> 'findComponent') then
ShowMessage('Object ['+ Z_STRVAL(p[0]^) + ':' + TComponent(Z_LVAL(p[0]^)).Name + ',' + TComponent(Z_LVAL(p[0]^)).ClassName + '] ' + Z_STRVAL(p[1]^));
}if not existMethod(Z_LVAL(p[0]^), Z_STRVAL(p[1]^)) then Exit;
case ht of //ïîëó÷àåì êîëè÷åñòâî ïåðåäàííûõ àðãóìåíòîâ
2: begin
//åñëè àðãóìåíòà äâà - ñîîòâåòñòâåííî, àðãóìåíòû âûçîâà ìåòîäà íå ïåðåäàíû,
//ïåðåäà¸ì åìó ïóñòîé ìàññèâ
zval_TVALUE(callMethod(Z_LVAL(p[0]^), Z_STRVAL(p[1]^), []), return_value);
end;
3: begin
{$IFDEF PHP7}
if p[2]^.u1.v._type <> IS_ARRAY then
{$ELSE}
if p[2]^._type <> IS_ARRAY then
{$ENDIF}
//åñëè íàì ïåðåäàëè ìàññèâ(åäèíñòâåííîå, ÷òî ìîæíî ïåðåäàòü ._.)
begin
zend_wrong_param_count(TSRMLS_DC);
goto ex1;
end;
{$IFDEF PHP7}
HashToArray(p[2]^.value.arr, ar);//ïðåâðàùàåì åãî èç õýø-òàáëèöû â ìàññèâ
{$ELSE}
HashToArray(p[2]^.value.ht, ar);//ïðåâðàùàåì åãî èç õýø-òàáëèöû â ìàññèâ
{$ENDIF}
if (Length(ar) = 0) then //åñëè äëèíà ìàññèâà ðàâíà íóëþ (åñëè îí ïóñòîé)
begin
//Âîçâðàùàåì ðåçóëüòàò âûçîâà ôóíêöèè/ìåòîäà ñ ïåðåäà÷åé ïóñòîãî ìàññèâà àðãóìåíòîâ.
zval_TVALUE(callMethod(Z_LVAL(p[0]^), Z_STRVAL(p[1]^), []), return_value);
end
else
begin
//Çàäà¸ì äëèíó ìàññèâó äëÿ ïåðåäà÷è ñâîéñòâ
SetLength(arr, 0);
//Ïîëó÷àåì òèï âñåõ ïàðàìåòðîâ ìåòîäà
ctx := TRttiContext.Create;
c := TObject(integer(Z_LVAL(p[0]^)));
if not Assigned(c) then goto ex1;
lType:=ctx.GetType(c.ClassInfo);
if not Assigned(lType) then goto ex1;
if Assigned(lType) then
begin
lMethod:=lType.GetMethod( Z_STRVAL(p[1]^) );
if Assigned(lMethod) then
params := lMethod.GetParameters;
end else goto ex1;
L := Length(ar);
//Ïðîáåãàåìñÿ ïî ìàññèâó ïàðàìåòðîâ (òèïîâ àðãóìåíòîâ)
I := -1;
try
for xp in params do
begin
SetLength(arr, Length(arr)+1);
I := I + 1;
//Åñëè êîëè÷åñòâî òðåáóåìûõ è ïåðåäàííûõ ïàðàìåòðîâ íå ñîâïàëî...
if L < I then begin
//... - ïèøåì, ÷òî àðãóìåíòîâ ïåðåäàíî íåäîñòàòî÷íî
zend_wrong_param_count(TSRMLS_DC);
dispose_pzval_array(p);
Exit;
end;
if xp.ParamType.TypeKind = tkClass then
begin
ClassOfP := xp.ParamType.AsInstance.MetaclassType;
if ar[I] = Null then
begin
arr[High(arr)] := TValue.From<TObject>(nil);
end
else
arr[High(arr)] := TValue.From<TObject>(TObject( integer( ar[I] )) as ClassOfP);
end else
arr[High(arr)] := ValueFromVariant(ar[I], xp.ParamType.TypeKind);
end;
except
on E: exception do
begin
dispose_pzval_array(p);
Exit;
end;
end;
//ShowMessage('s');
zval_TVALUE(callMethod(Z_LVAL(p[0]^), Z_STRVAL(p[1]^), arr), return_value);
end;
end;
end;
ex1:
dispose_pzval_array(p);
Exit;
end;
procedure gui_methodList;
var
p: pzval_array;
arrn: TWSDate;
begin
if ht <> 1 then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
listMethod(Z_LVAL(p[0]^), @arrn);
ZVAL_ARRAY(return_value, arrn);
dispose_pzval_array(p);
end;
procedure gui_propList;
var
p: pzval_array;
begin
if (ht < 1) or (ht > 2) then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
if ht <2 then
begin
ZVAL_STRINGW(return_value, PWideChar(getProperties(Z_LVAL(p[0]^), -1)), True);
end
else
begin
ZVAL_STRINGW(return_value, PWideChar(getProperties(Z_LVAL(p[0]^), Z_LVAL(p[1]^))), True);
end;
dispose_pzval_array(p);
end;
procedure gui_class_propList;
var
p: pzval_array;
begin
if (ht < 1) or (ht > 2) then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
if ht <2 then
begin
ZVAL_STRINGW(return_value, PWideChar(getPropertiesfClass(Z_STRVAL(p[0]^), -1)), True);
end
else
begin
ZVAL_STRINGW(return_value, PWideChar(getPropertiesfClass(Z_STRVAL(p[0]^), Z_LVAL(p[1]^))), True);
end;
dispose_pzval_array(p);
end;
procedure gui_class_propArray;
var
p: pzval_array;
arrn: TWSDate;
arrv: TWSDate;
begin
if (ht < 1) or (ht > 2) then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
if ht < 2 then
begin
getPropertiesfClassArr(Z_STRVAL(p[0]^), -1, @arrn, @arrv);
ZVAL_ARRAYWS(return_value, arrn, arrv);
end
else
begin
getPropertiesfClassArr(Z_STRVAL(p[0]^), Z_LVAL(p[1]^), @arrn, @arrv);
ZVAL_ARRAYWS(return_value, arrn, arrv);
end;
dispose_pzval_array(p);
end;
procedure log(ast: zend_ustr);
var ass: TStringList;
begin
ass := TStringList.Create();
if( FileExists('kr_log.txt') )
then ass.LoadFromFile('kr_log.txt');
ass.Append(ast);
ass.SaveToFile('kr_log.txt');
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);
{$IFDEF PHP7}
if p[0]^^.u1.v._type <> IS_NULL then
{$ELSE}
if p[0]^^._type <> IS_NULL then
{$ENDIF}
begin
ZVALVAL(return_value,
setProperty(Z_LVAL(p[0]^), Z_STRVAL(p[1]^), ZendToVariant(p[2]^)));
end
else
ZVALVAL(return_value,FALSE);
dispose_pzval_array(p);
end;
procedure gui_get_RecordInfo;
var
p: pzval_array;
arrn, arrv: TWSDate;
begin
if ht <> 2 then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
getEnumPropValues( Z_STRVAL(p[0]^), Z_STRVAL(p[1]^), @arrn, @arrv);
ZVAL_ARRAYWS(return_value, arrn, arrv);
dispose_pzval_array(p);
end;
procedure gui_get_evt_paramss;
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);
{$IFDEF PHP7}
if (p[0]^^.u1.v._type = IS_LONG) and (p[1]^^.u1.v._type = IS_STRING) then
{$ELSE}
if (p[0]^^._type = IS_LONG) and (p[1]^^._type = IS_STRING) then
{$ENDIF}
begin
ZVAL_STRINGW(return_value, PWideChar(
evt_params( Z_LVAL(p[0]^), Z_STRVAL(p[1]^) )
), True);
end
else
begin
ZVAL_STRINGW(return_value, PWideChar(
evt_params( Z_STRVAL(p[0]^), Z_STRVAL(p[1]^) )
), True);
end;
dispose_pzval_array(p);
end;
procedure gui_get_evt_paramnames;
var
p: pzval_array;
arrn: TWSDate;
begin
if ht <> 2 then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
evt_param_names(Z_STRVAL(p[0]^), Z_STRVAL(p[1]^), @arrn);
ZVAL_ARRAY(return_value, arrn);
dispose_pzval_array(p);
end;
procedure gui_get_evt_paramtypes;
var
p: pzval_array;
arrn: TWSDate;
begin
if ht <> 2 then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
evt_param_types(Z_STRVAL(p[0]^), Z_STRVAL(p[1]^), @arrn);
ZVAL_ARRAY(return_value, arrn);
dispose_pzval_array(p);
end;
procedure gui_get_evt_assci;
var
p: pzval_array;
arrn, arrv: TWSDate;
begin
if ht <> 2 then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
evt_param_names(Z_STRVAL(p[0]^), Z_STRVAL(p[1]^), @arrv);
evt_param_types(Z_STRVAL(p[0]^), Z_STRVAL(p[1]^), @arrn);
ZVAL_ARRAYWS(return_value, arrn, arrv);
dispose_pzval_array(p);
end;
procedure gui_class_methodList;
var
p: pzval_array;
arrn, arrv: TWSDate;
begin
if ht <> 1 then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
listMethodfClass( Z_STRVAL(p[0]^), @arrn, @arrv );
ZVAL_ARRAYWS(return_value, arrn, arrv);
dispose_pzval_array(p);
end;
procedure gui_get_method_params;
var
p: pzval_array;
arrn: TWSDate;
arrv: TWSDate;
begin
if ht <> 2 then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
getMethodParamsfClass(Z_STRVAL(p[0]^), Z_STRVAL(p[1]^), @arrn, @arrv);
ZVAL_ARRAYWS(return_value, arrn, arrv);
dispose_pzval_array(p);
end;
procedure gui_class_method_exist;
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);
//Ïðîâåðÿåì ìåòîä íà ñóùåñòâîâàíèå,
//Âîçðàùàåì áóëåâî ÷èñëî = 0 u 1
ZVALVAL(return_value, existMethodClass(Z_STRVAL(p[0]^), Z_STRVAL(p[1]^)));
dispose_pzval_array(p);
end;
procedure gui_method_params;
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_STRINGW(return_value, PWideChar(getMethodParamss(Z_STRVAL(p[0]^), Z_STRVAL(p[1]^))), True);
dispose_pzval_array(p);
end;
procedure gui_get_all_unitsclasses;
var
arrv: TWSDate;
begin
if ht <> 0 then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
get_all_classes(@arrv);
ZVAL_ARRAY(return_value, arrv);
end;
procedure rtl;
var
p: pzval_array;
begin
if ht <> 1 then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
ZVALVAL(return_value, LoadRTL(Z_STRVAL(p[0]^)));
dispose_pzval_array(p);
end;
procedure rtll;
var
p: pzval_array;
begin
if ht <> 1 then
begin
zend_wrong_param_count(TSRMLS_DC);
Exit;
end;
zend_get_parameters_my(ht, p, TSRMLS_DC);
ZVALVAL(return_value, RTLLoaded(Z_STRVAL(p[0]^)));
dispose_pzval_array(p);
end;
procedure gpreadable;
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);
ZVALVAL(return_value, getPropReadable(string(Z_STRVAL(p[0]^)), string(Z_STRVAL(p[1]^))));
dispose_pzval_array(p);
end;
procedure gpwritable;
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);
ZVALVAL(return_value, getPropWritable(string(Z_STRVAL(p[0]^)), string(Z_STRVAL(p[1]^))));
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_methodList', @gui_methodList);
PHPEngine.AddFunction('gui_methodExists', @gui_methodExists);
PHPEngine.AddFunction('gui_methodCall', @gui_methodCall);
PHPEngine.AddFunction('gui_methodrtype', @gui_methodrtype);
PHPEngine.AddFunction('gui_propList', @gui_propList);
PHPEngine.AddFunction('gui_class_propList', @gui_class_propList);
PHPEngine.AddFunction('gui_class_propArray', @gui_class_propArray);
PHPEngine.AddFunction('gui_propSet', @gui_propSet);
PHPEngine.AddFunction('gui_get_event_paramss', @gui_get_evt_paramss);
PHPEngine.AddFunction('gui_get_event_param_names', @gui_get_evt_paramtypes);
PHPEngine.AddFunction('gui_get_event_param_types', @gui_get_evt_paramnames);
PHPEngine.AddFunction('gui_get_event_assoc_info', @gui_get_evt_assci);
PHPEngine.AddFunction('gui_class_methodList', @gui_class_methodList);
PHPEngine.AddFunction('gui_get_method_params', @gui_get_method_params);
PHPEngine.AddFunction('gui_method_paramss', @gui_method_params);
PHPEngine.AddFunction('gui_get_all_unitsclasses', @gui_get_all_unitsclasses);
PHPEngine.AddFunction('gui_class_prop_isreadable', @gpreadable);
PHPEngine.AddFunction('gui_class_prop_iswritable', @gpwritable);
PHPEngine.AddFunction('gui_get_RecordInfo', @gui_get_RecordInfo);
PHPEngine.AddFunction('rtl', @rtl);
PHPEngine.AddFunction('rtll', @rtll);
end;
end.