Skip to content

Commit d5a2f2a

Browse files
php.inc: /rework/ user-friendly
1 parent 6374a68 commit d5a2f2a

File tree

5 files changed

+1922
-1910
lines changed

5 files changed

+1922
-1910
lines changed

Source/PHP.INC

Lines changed: 90 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -5,101 +5,104 @@
55
{ Author: }
66
{ Serhiy Perevoznyk }
77
8-
{ http://users.chello.be/ws36637 }
9-
{ http://delphi32.blogspot.com }
8+
{ https://users.chello.be/ws36637 }
9+
{ https://delphi32.blogspot.com }
1010
{*******************************************************}
1111

12-
{ $Id: PHP.INC,v 7.4 10/2009 delphi32 Exp $ }
12+
{ $Id: PHP.INC,v 7.4 07/2020 delphi32 Exp $ }
1313

1414
{IMPORTANT:
15-
If you are using PHP version 5.0 please add $DEFINE PHP5
16-
If you are using PHP version 5.0.4 please add $DEFINE PHP504
17-
If you are using PHP version 5.1.0 or higher please add $DEFINE PHP510
18-
If you are using PHP version 5.1.1 or higher please add $DEFINE PHP511
19-
If you are using PHP version 5.1.2 or higher please add $DEFINE PHP512
20-
If you are using PHP version 5.2.0 or higher please add $DEFINE PHP520
21-
IF you are using PHP version 5.3.0 or higher please add $DEFINE PHP530
22-
IF you are using PHP version 5.4.0 or higher please add $DEFINE PHP540
23-
IF you are using PHP version 5.5.0 or higher please add $DEFINE PHP550
24-
IF you are using PHP version 5.6.0 or higher please add $DEFINE PHP560
25-
IF you are using PHP cersion 7.0.0 or higher please add $DEFINE PHP700
26-
If you are using PHP compiled via:
27-
id, define compiler_id
28-
VC9 COMPILER_VC9
29-
VC10 COMPILER_VC10
30-
VC11 COMPILER_VC11
31-
VC12 COMPILER_VC12
32-
VC13 COMPILER_VC13
33-
VC14 COMPILER_VC14
34-
Sorry for such complicated configuration, but PHP team does not keep
35-
backward compatibility between PHP versions.
15+
Define suitable PHP version, the table is represented below:
16+
| Version | Directive |
17+
5.0 $DEFINE PHP5
18+
5.0.4 $DEFINE PHP504
19+
5.1.0 $DEFINE PHP510
20+
5.1.1 $DEFINE PHP511
21+
5.1.2 $DEFINE PHP512
22+
5.2 $DEFINE PHP520
23+
5.3 $DEFINE PHP530
24+
5.4 $DEFINE PHP540
25+
5.5 $DEFINE PHP550
26+
5.6 $DEFINE PHP560
27+
7.0 $DEFINE PHP7
28+
7.1 $DEFINE PHP710
29+
30+
Define suitable visual library
31+
| Library | Directive |
32+
VCL $DEFINE VCL
33+
FMX $DEFINE FMX
3634
}
3735

38-
{PHP5 must be defined if you are using PHP5}
39-
{$DEFINE PHP5}
40-
41-
{For PHP5 you have to define the subversion of PHP}
42-
{$DEFINE PHP504}
43-
{$DEFINE PHP510}
44-
{$DEFINE PHP511}
45-
{$DEFINE PHP512}
46-
{$DEFINE PHP520}
47-
{$DEFINE PHP530}
48-
{$DEFINE PHP540}
49-
{$DEFINE PHP550}
36+
//Version
5037
{$DEFINE PHP560}
38+
{$DEFINE VCL}
39+
40+
//Features
41+
{$DEFINE PHP_UNICODE}
42+
//PHP unicode support *Enables WideString and UnicodeString
43+
{$DEFINE REGISTER_COLOURS}
44+
//constants for Delphi colours
45+
{.$DEFINE QUIET_LOAD}
46+
//Do not show errors while loading php library
47+
{.$DEFINE PHP4DELPHI_AUTOLOAD}
48+
//Load php library at initialization
49+
{.$DEFINE PHP4DELPHI_AUTOUNLOAD}
50+
// Unload php library at finalization
51+
52+
//Compiler switches
53+
{.$DEFINE php_side_handler}
54+
//enable ability to define own error handler from php side ~NON_TC
55+
{.$DEFINE COMPILER_php7pv}
56+
// use macroses from PHP sources patch
57+
// https://github.com/resistancelion/no-name-engine/tree/master/php-src
58+
{.$DEFINE PHP_DEBUG}
59+
//use debug libraries (php7debug, f.e)
60+
61+
62+
63+
64+
65+
66+
67+
68+
69+
70+
71+
72+
73+
74+
//E N D
75+
{$WARN UNIT_DEPRECATED OFF}
76+
{$IFDEF PHP_UNICODE} {$DEFINE UNICODE} {$ENDIF}
77+
78+
{$IFDEF PHP710} {$DEFINE PHP700} {$ENDIF}
79+
{$IFDEF PHP700} {$DEFINE PHP7} {$ENDIF}
80+
81+
{$IFDEF PHP7} {$DEFINE PHP560} {$ENDIF}
82+
{$IFDEF PHP560} {$DEFINE PHP550} {$ENDIF}
83+
{$IFDEF PHP550} {$DEFINE PHP540} {$ENDIF}
84+
{$IFDEF PHP540} {$DEFINE PHP530} {$ENDIF}
5185
{$IFDEF PHP530}
86+
{$DEFINE PHP520}
5287
{$DEFINE ZEND_WIN32}
5388
{$DEFINE PHP_COMPILER_ID}
5489
{$ENDIF}
55-
{$DEFINE soulengine_build}
56-
{.$DEFINE PHP7}
57-
{.$DEFINE CUTTED_PHP7dll}
58-
{$IFDEF PHP7}
59-
{$DEFINE COMPILER_VC14}
60-
{$DEFINE PHP560}
61-
{$DEFINE PHP700}
62-
{$ENDIF}
63-
{$IFDEF PHP560}
64-
{$DEFINE PHP530}
65-
{$DEFINE PHP540}
66-
{$DEFINE PHP550}
67-
{$DEFINE ZEND_WIN32}
68-
{$DEFINE PHP_COMPILER_ID}
69-
{$ENDIF}
70-
//Warning! You must select one of the compilers
71-
//Look at the version of PHP you have installed
72-
//I DO recommend to use php-5.6.40-Win32-VC11-x86, specially if you are using
73-
//php4delphi component with php5ts.dll. If you are building PHP extensions,
74-
//you have to define the right compiler, otherwise you would have incompatibility
75-
//problems
76-
90+
{$IFDEF PHP520} {$DEFINE PHP512} {$ENDIF}
91+
{$IFDEF PHP512} {$DEFINE PHP511} {$ENDIF}
92+
{$IFDEF PHP511} {$DEFINE PHP510} {$ENDIF}
93+
{$IFDEF PHP510} {$DEFINE PHP504} {$ENDIF}
94+
{$IFDEF PHP504} {$DEFINE PHP5} {$ENDIF}
7795
{$IFDEF PHP_COMPILER_ID}
7896
{$DEFINE COMPILER_VC9}
7997
{$IFNDEF PHP7}
8098
{$IFDEF PHP550} {$DEFINE COMPILER_VC11} {$ENDIF}
81-
{$ENDIF}
99+
{$ELSE}
100+
{$DEFINE COMPILER_VC14}
101+
{$ENDIF}
82102
{$ENDIF}
83103

84-
{$WARN UNIT_DEPRECATED OFF}
85-
86-
{.$DEFINE QUIET_LOAD} //Do not show error while loading php4ts.dll or php5ts.dll (depends from php version)
87-
88-
{.$DEFINE PHP4DELPHI_AUTOLOAD} //Load php4ts.dll or php5ts.dll at initialization
89-
{.$DEFINE PHP4DELPHI_AUTOUNLOAD} // Unload php4ts.dll or php5ts.dll at finalization
90-
91-
{.$DEFINE PHP_DEBUG}
92-
93-
{$DEFINE REGISTER_COLORS} //register php constants for colors
94-
95104
{$IFNDEF LINUX}
96-
{$DEFINE ZTS} {zts support}
97-
{$ENDIF}
98-
99-
{$IF Defined(COMPILER_VC11) and Defined(PHP560) or Defined(PHP7)}
100-
{$DEFINE PHP_UNICODE}
101-
{$ELSEIF Defined(COMPILER_VC12) or Defined(COMPILER_VC13) or Defined(COMPILER_VC14) or Defined(COMPILER_VC15)}
102-
{$DEFINE PHP_UNICODE}
105+
{$DEFINE ZTS} {zend thread safety support}
103106
{$ENDIF}
104107

105108
{$IFNDEF VER80} {Delphi 1.0}
@@ -205,6 +208,14 @@ backward compatibility between PHP versions.
205208
{$WARNINGS OFF}
206209
{$ENDIF}
207210

208-
{$IFDEF MSWINDOWS}
209-
{$DEFINE WINDOWS}
211+
{$IFDEF MSWINDOWS} {$DEFINE WINDOWS} {$ENDIF}
212+
{$IFDEF FPC}
213+
{$IFDEF FMX} {$UNDEF FMX} {$ENDIF}
214+
{$IFDEF VCL} {$UNDEF VCL} {$ENDIF}
215+
{$DEFINE LCL}
216+
{$ELSE}
217+
{$IFDEF LCL}
218+
{$UNDEF LCL}
219+
{$DEFINE VCL}
220+
{$ENDIF}
210221
{$ENDIF}

Source/PHPAPI.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ function GetSAPIGlobals(TSRMLS_DC : pointer) : Psapi_globals_struct; overload;
177177

178178

179179

180-
{$IFNDEF CUTTED_PHP7dll}
180+
{$IFNDEF COMPILER_php7pv}
181181
php_log_err: procedure (err_msg : zend_pchar; TSRMLS_DC : pointer); cdecl;
182182
{$ENDIF}
183183
php_html_puts: procedure (str : zend_pchar; str_len : integer; TSRMLS_DC : pointer); cdecl;
@@ -587,7 +587,7 @@ function LoadPHP(const DllFileName: zend_ustr = PHPWin) : boolean;
587587
LFunc(@php_body_write, 'php_body_write' );
588588
LFunc(@php_header_write, 'php_header_write');
589589
{$ENDIF}
590-
{$IFNDEF CUTTED_PHP7dll}
590+
{$IFNDEF COMPILER_php7pv}
591591
LFunc(@php_log_err, 'php_log_err');
592592
{$ENDIF}
593593
LFunc(@php_html_puts, 'php_html_puts');

Source/ZENDAPI.pas

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ procedure dispose_pzval_array(Params: pzval_array);
592592
add_property_stringl_ex : function(arg: pzval; key: zend_pchar; key_len: uint; str: zend_pchar; len: uint; duplicate: integer; TSRMLS_DC: Pointer): integer; cdecl;
593593
add_property_zval_ex : function(arg: pzval; key: zend_pchar; key_len: uint; value: pzval; TSRMLS_DC: Pointer): integer; cdecl;
594594

595-
{$IFDEF CUTTED_PHP7dll}
595+
{$IFDEF COMPILER_php7pv}
596596
call_user_function : procedure(func:pzval; argv:pzval; argc:integer);cdecl;
597597
{$ELSE}
598598
call_user_function : function(function_table: PHashTable; object_pp: pzval;
@@ -2399,7 +2399,7 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
23992399
{$IFDEF PHP7}
24002400
LFunc(@_zend_hash_add_or_update, '_zend_hash_add_or_update@@16');
24012401
LFunc(@_zend_hash_add, '_zend_hash_add@@12');
2402-
{$IFDEF CUTTED_PHP7dll}
2402+
{$IFDEF COMPILER_php7pv}
24032403
LFunc(@zend_hash_index_findZval,'zend_hash_index_findZval');
24042404
LFunc(@zend_symtable_findTest,'zend_symtable_findTest');
24052405
LFunc(@zend_hash_index_existsZval,'zend_hash_index_existsZval');
@@ -2809,8 +2809,8 @@ function LoadZEND(const DllFilename: zend_ustr = PHPWin) : boolean;
28092809
// -- add_property_zval_ex
28102810
LFunc(@add_property_zval_ex, 'add_property_zval_ex');
28112811

2812-
LFunc(@call_user_function, {$IFDEF CUTTED_PHP7dll}'__call_function'{$ELSE}'call_user_function'{$ENDIF});
2813-
{$IFNDEF CUTTED_PHP7dll}
2812+
LFunc(@call_user_function, {$IFDEF COMPILER_php7pv}'__call_function'{$ELSE}'call_user_function'{$ENDIF});
2813+
{$IFNDEF COMPILER_php7pv}
28142814
LFunc(@call_user_function_ex, 'call_user_function_ex');
28152815
{$ENDIF}
28162816
// -- add_assoc_long_ex

Source/hzend_types.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
interface
44

5-
uses Winapi.Windows;
5+
uses {$IFDEF FPC}Winapi.Windows{$ELSE}Windows{$ENDIF};
66

77
var
88
_TestCreate:Pointer;

0 commit comments

Comments
 (0)