Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fcd7e70

Browse files
author
Andrew Zenin
committed
zval routines
1 parent b85018e commit fcd7e70

File tree

5 files changed

+217
-183
lines changed

5 files changed

+217
-183
lines changed

‎Source/DelphiFunctions.pas‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ procedure delphi_date(ht : integer; return_value : pzval; this_ptr : pzval;
198198
return_value_used : integer; TSRMLS_DC : pointer); cdecl;
199199
{$ENDIF}
200200
begin
201-
ZVAL_DOUBLE(return_value, Date);
201+
ZVALVAL(return_value, Date);
202202
end;
203203

204204
//proto string delphi_extract_file_dir(string source)
@@ -658,7 +658,7 @@ procedure delphi_is_uc(ht : integer; return_value : pzval; this_ptr : pzval;
658658
return_value_used : integer; TSRMLS_DC : pointer);
659659
{$ENDIF}
660660
begin
661-
{$IFDEF PHP_UNICE}ZVAL_TRUE{$ELSE}ZVAL_FALSE{$ENDIF}(return_value);
661+
ZVALVAL(return_value, {$IFDEF PHP_UNICE}TRUE{$ELSE}FALSE{$ENDIF});
662662
end;
663663

664664
{$IFDEF PHP510}

‎Source/PHPAPI.pas‎

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,6 @@ function GetSAPIGlobals(TSRMLS_DC : pointer) : Psapi_globals_struct; overload;
199199
php_ini_double: function(name : zend_pchar; name_length : uint; orig : Integer) : Double; cdecl;
200200

201201
php_ini_string: function(name : zend_pchar; name_length : uint; orig : Integer) : zend_pchar; cdecl;
202-
203-
function zval2variant(value : zval) : variant;
204-
procedure variant2zval(value : variant; var z : pzval);
205-
206-
207202
var
208203

209204
php_url_free: procedure (theurl : pphp_url); cdecl;
@@ -426,19 +421,6 @@ function GetSAPIGlobals(TSRMLS_DC : pointer) : Psapi_globals_struct;
426421
end;
427422
end;
428423

429-
function zval2variant(value : zval) : variant;
430-
begin
431-
case {$IFDEF PHP7}Value.u1.v._type{$ELSE}Value._type{$ENDIF} of
432-
IS_NULL : Result := NULL;
433-
IS_LONG : Result := Value.value.lval;
434-
IS_DOUBLE : Result := Value.value.dval;
435-
IS_STRING : Result := zend_ustr(Value.Value.str.val);
436-
IS_BOOL : Result := Boolean(Value.Value.lval);
437-
else
438-
Result := NULL;
439-
end;
440-
end;
441-
442424
function GetStringOf(const V: TVarData): string;
443425
begin
444426
case V.VType of
@@ -485,65 +467,6 @@ function GetStringOf(const V: TVarData): string;
485467
end;
486468
end;
487469

488-
489-
procedure variant2zval(value : variant;var z : pzval);
490-
var
491-
W : WideString;
492-
S: String;
493-
begin
494-
if VarIsEmpty(value) then
495-
begin
496-
ZVAL_NULL(z);
497-
Exit;
498-
end;
499-
// MessageBoxA(0, zend_pchar(zend_ustr( TVarData(Value).VType.ToString)), '', 0 ) ;
500-
case TVarData(Value).VType of
501-
varString : //Peter Enz
502-
begin
503-
if Assigned ( TVarData(Value).VString ) then
504-
begin
505-
ZVAL_STRING(z, TVarData(Value).VString , true);
506-
end
507-
else
508-
begin
509-
ZVAL_STRING(z, '', true);
510-
end;
511-
end;
512-
513-
varUString : //Peter Enz
514-
begin
515-
S := string(TVarData(Value).VUString);
516-
517-
ZVAL_STRING(z, zend_pchar(zend_ustr(S)), true);
518-
end;
519-
520-
varOleStr : //Peter Enz
521-
begin
522-
if Assigned ( TVarData(Value).VOleStr ) then
523-
begin
524-
W := WideString(Pointer(TVarData(Value).VOleStr));
525-
ZVAL_STRINGW(z, PWideChar(W), true);
526-
end
527-
else
528-
begin
529-
ZVAL_STRING(z, '', true);
530-
end;
531-
end;
532-
varSmallInt : ZVAL_LONG(z, Integer(TVarData(Value).VSmallint));
533-
varInteger : ZVAL_LONG(z, TVarData(Value).VInteger);
534-
varBoolean : ZVAL_BOOL(z, TVarData(Value).VBoolean);
535-
varSingle : ZVAL_DOUBLE(z, TVarData(Value).VSingle);
536-
varDouble : ZVAL_DOUBLE(z, TVarData(Value).VDouble);
537-
varError : ZVAL_LONG(z, Integer(TVarData(Value).VError));
538-
varByte : ZVAL_LONG(z, Integer(TVarData(Value).VByte));
539-
varDate : ZVAL_DOUBLE(z, TVarData(Value).VDate);
540-
//varArray : ZVAL_ARRAY(z, Value);
541-
else
542-
ZVAL_NULL(Z);
543-
end;
544-
end;
545-
546-
547470
function GetPHPGlobals(TSRMLS_DC : pointer) : Pphp_Core_Globals;
548471
var
549472
core_globals_value : integer;

‎Source/PHPFunctions.pas‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ function TZendVariable.GetAsVariant: variant;
657657
Exit;
658658
end;
659659

660-
result := zval2variant(FValue^);
660+
result := ZendToVariant(FValue);
661661
end;
662662

663663
function TZendVariable.GetDataType: integer;
@@ -709,7 +709,7 @@ procedure TZendVariable.SetAsBoolean(const Value: boolean);
709709
begin
710710
Exit;
711711
end;
712-
ZVAL_BOOL(FValue, Value);
712+
ZVALVAL(FValue, Value);
713713
end;
714714

715715
procedure TZendVariable.SetAsDate(const Value: TDateTime);
@@ -718,7 +718,7 @@ procedure TZendVariable.SetAsDate(const Value: TDateTime);
718718
begin
719719
Exit;
720720
end;
721-
ZVAL_DOUBLE(FValue, Value);
721+
ZVALVAL(FValue, Value);
722722
end;
723723

724724
procedure TZendVariable.SetAsDateTime(const Value: TDateTime);
@@ -727,7 +727,7 @@ procedure TZendVariable.SetAsDateTime(const Value: TDateTime);
727727
begin
728728
Exit;
729729
end;
730-
ZVAL_DOUBLE(FValue, Value);
730+
ZVALVAL(FValue, Value);
731731
end;
732732

733733
procedure TZendVariable.SetAsFloat(const Value: double);
@@ -736,7 +736,7 @@ procedure TZendVariable.SetAsFloat(const Value: double);
736736
begin
737737
Exit;
738738
end;
739-
ZVAL_DOUBLE(FValue, Value);
739+
ZVALVAL(FValue, Value);
740740
end;
741741

742742
procedure TZendVariable.SetAsInteger(const Value: integer);
@@ -745,7 +745,7 @@ procedure TZendVariable.SetAsInteger(const Value: integer);
745745
begin
746746
Exit;
747747
end;
748-
ZVAL_LONG(FValue, Value);
748+
ZVALVAL(FValue, Value);
749749
end;
750750

751751
procedure TZendVariable.SetAsString(const Value: zend_ustr);
@@ -754,7 +754,7 @@ procedure TZendVariable.SetAsString(const Value: zend_ustr);
754754
begin
755755
Exit;
756756
end;
757-
ZVAL_STRINGL(FValue, zend_pchar(Value), Length(Value), true);
757+
ZVALVAL(FValue, zend_pchar(Value), Length(Value));
758758
end;
759759

760760
procedure TZendVariable.SetAsTime(const Value: TDateTime);
@@ -763,7 +763,7 @@ procedure TZendVariable.SetAsTime(const Value: TDateTime);
763763
begin
764764
Exit;
765765
end;
766-
ZVAL_DOUBLE(FValue, Value);
766+
ZVALVAL(FValue, Value);
767767
end;
768768

769769
procedure TZendVariable.SetAsVariant(const Value: variant);
@@ -772,7 +772,7 @@ procedure TZendVariable.SetAsVariant(const Value: variant);
772772
begin
773773
Exit;
774774
end;
775-
variant2zval(Value, FValue);
775+
VariantToZend(Value, FValue);
776776
end;
777777

778778

@@ -782,7 +782,7 @@ procedure TZendVariable.UnAssign;
782782
begin
783783
Exit;
784784
end;
785-
ZVAL_NULL(FValue);
785+
ZVALVAL(FValue);
786786
end;
787787

788788

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /