Skip to content

Commit

Permalink
Fix ApiVendorLName.operator=
Browse files Browse the repository at this point in the history
  • Loading branch information
SunSerega committed Sep 15, 2024
1 parent 5afe5d3 commit 96f50af
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
20 changes: 14 additions & 6 deletions DataScraping/XML/NamedItems.pas
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,21 @@
public property VendorSuffix: string read vendor_suffix;
public property LocalName: string read name;

public function Equals(other: TSelf) :=
not ReferenceEquals(other,nil) and (self.api=other.api) and (self.vendor_suffix=other.vendor_suffix) and (self.name=other.name);
public static function operator=(n1,n2: ApiVendorLName<TSelf>) :=
if ReferenceEquals(n1, nil) then
ReferenceEquals(n2, nil) else
n1.Equals(n2);
public static function operator=(n1,n2: ApiVendorLName<TSelf>): boolean;
begin
Result := ReferenceEquals(n1, n2);
if Result then exit;

if ReferenceEquals(n1, nil) then exit;
if ReferenceEquals(n2, nil) then exit;
if n1.api <> n2.api then exit;
if n1.vendor_suffix <> n2.vendor_suffix then exit;
if n1.name <> n2.name then exit;

Result := true;
end;
public static function operator<>(n1,n2: ApiVendorLName<TSelf>) := not(n1=n2);
public function Equals(other: TSelf) := self = other;
public function Equals(obj: object): boolean; override :=
(obj is TSelf(var other)) and (self=other);

Expand Down
29 changes: 12 additions & 17 deletions DataScraping/XML/OpenCL/ScrapXML.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1028,27 +1028,22 @@ function FuncSource.MakeNewItem: Func;

Result := new Func(self.Name, self.entry_point_name, pars, nil);

var err_code_gr := GroupSource.FindOrMakeItem(GroupSource.MakeName('cl_error_code',false,false), false);

var have_err_ret := pars.Any(par->par.ParType.TypeObj = err_code_gr);

var need_err_ret: boolean;
var need_err_ret_count: integer;
if self.Name.LocalName.StartsWith('LogMessagesTo') and (self.Name.VendorSuffix='APPLE') then
need_err_ret := false else
need_err_ret_count := 0 else
if self.Name.LocalName.StartsWith('SVM') then
need_err_ret := false else
need_err_ret_count := 0 else
if self.Name.LocalName.StartsWith('GetExtensionFunctionAddress') then
need_err_ret := false else
need_err_ret := true;
need_err_ret_count := 0 else
if self.Name = FuncSource.MakeName('clCreateProgramWithBinary', false, false) then
need_err_ret_count := 2 else
need_err_ret_count := 1;

if have_err_ret<>need_err_ret then
begin

if need_err_ret then
Otp($'WARNING: {Result} does not return errors') else
Otp($'WARNING: {Result} should not return errors');

end;
var err_code_gr := GroupSource.FindOrMakeItem(GroupSource.MakeName('cl_error_code',false,false), false);
var err_ret_count := pars.Count(par->par.ParType.TypeObj = err_code_gr);

if err_ret_count<>need_err_ret_count then
Otp($'WARNING: {Result} was expected to have {need_err_ret_count} err return parameters, but found {err_ret_count}');

end;

Expand Down

0 comments on commit 96f50af

Please sign in to comment.