Skip to content

Commit

Permalink
cleanup TODO's
Browse files Browse the repository at this point in the history
  • Loading branch information
SunSerega committed Mar 25, 2024
1 parent 3dfd522 commit 63f60a1
Show file tree
Hide file tree
Showing 57 changed files with 446 additions and 514 deletions.
11 changes: 2 additions & 9 deletions DataScraping/XML/ItemSources.pas
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ interface

public static procedure PrintAllNames := all_sources.Keys.PrintLines;

//TODO #2842
private static function constructor_hotfix: byte;
private static aaaaa := constructor_hotfix;
// static constructor;
static constructor;

protected static function MakeName<TFullName>(api, s, api_beg: string; allow_nil, skip_invalid: boolean; api_underscore_sep: boolean?; known_suffixes: HashSet<string>; params suffix_formats: array of string): TFullName;
where TFullName: ApiVendorLName<TFullName>;
Expand Down Expand Up @@ -55,7 +52,6 @@ interface

protected constructor(name: TSourceName);
begin
aaaaa := aaaaa;
self._name := name;
if name in all_sources then
raise new InvalidOperationException(self.ToString);
Expand Down Expand Up @@ -127,12 +123,9 @@ implementation

var source_create_callbacks: Action;

//TODO #2842
static function ItemSource<TSelf,TSourceName,TItem>.constructor_hotfix: byte;
//static constructor ItemSource<TSelf,TSourceName,TItem>.Create;
static constructor ItemSource<TSelf,TSourceName,TItem>.Create;
begin
// Println(TypeToTypeName(typeof(TSelf)));
Result := 0;

source_create_callbacks += ()->
foreach var s in all_sources.Values do
Expand Down
13 changes: 4 additions & 9 deletions DataScraping/XML/NamedItems.pas
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@

{$region Pre-saving}

//TODO #????: as
//TODO #3059: as, use operator explicit
protected function NameApi: string; virtual := (self.Name as IComplexName).ApiName;
protected function NameSuffix: string; virtual := (self.Name as IComplexName).VendorSuffix;
protected function NameLocal: string; virtual := (self.Name as IComplexName).LocalName;
Expand Down Expand Up @@ -358,16 +358,11 @@
if perform_merge<>false then
raise new InvalidOperationException;

save_ready := Defined.Values.Where(_item->
begin
//TODO #????: as
var item := _item as NamedItem<TSelf, TName>;
Result := item.merged_into=nil;
end).Distinct.ToArray;
save_ready := Defined.Values.Where(item->item.merged_into=nil).Distinct.ToArray;
Sort(save_ready, item->item.Name);

for var i := 0 to save_ready.Length-1 do
//TODO #????: as
//TODO #3060: as
(save_ready[i] as NamedItem<TSelf, TName>).bin_index := i;

end;
Expand Down Expand Up @@ -422,7 +417,7 @@
end;
public static function DistillAllUnique(inp: sequence of TSelf) := DistillAllUnique(inp, o->o, nil).ConvertAll(o->o.AfterMerges);

//TODO #????
//TODO #3059: as, use operator explicit
protected procedure SaveName(bw: BinWriter); virtual := (Name as IBinSavable).Save(bw);
protected procedure SaveBody(bw: BinWriter); abstract;
private saved := false;
Expand Down
2 changes: 1 addition & 1 deletion DataScraping/XML/XMLItems.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,7 @@ procedure SaveAll;
if named_types_save_proc.TryGetValue(cl, p) then
p(bw) else
begin
Log.Otp($'No {cl} to save'); //TODO Should only be Struct in GL - check
Log.Otp($'No {cl} to save');
bw.Write(0);
end;
end;
Expand Down
102 changes: 47 additions & 55 deletions Modules.Packed/OpenCLABC.pas

Large diffs are not rendered by default.

102 changes: 47 additions & 55 deletions Packing/Descriptions/OpenCLABC.predoc

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions Packing/Template/HighLvl/OpenCLABC/CLKernelArg.pas
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

uses '../../Common/PackingUtils';

//TODO Генерация теста

type
FromMethodSettings = record
public inp_nick, par_name, inp_tname: string;
Expand Down Expand Up @@ -472,11 +470,6 @@ all += class_name;
m += s.inp_nick;
m += '(';
m += s.par_name;
//TODO #????
begin
m += ' as object as ';
write_inp_t(m, 'CommandQueue');
end;
m += ') end;'#10;

t += 'TestT&<';
Expand Down Expand Up @@ -584,7 +577,7 @@ t += class_name;

end);

//TODO #2650: Как исправят - перенести в начало [Managed]
//TODO #3054: Как исправят - перенести в начало [Managed]
begin
var s := FromMethodSettings.Create('Value', 'val', nil, true, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type
static function CLKernelArgConstant.FromCLMemory(cl_mem: CommandQueue<CLMemory>): CLKernelArgConstant;
begin Result := new CLKernelArgConstantCLMemory(cl_mem) end;
static function CLKernelArgConstant.operator implicit(cl_mem: CLMemoryCCQ): CLKernelArgConstant;
begin Result := FromCLMemory(cl_mem as object as CommandQueue<CLMemory>) end;
begin Result := FromCLMemory(cl_mem) end;

{$endregion CLMemory}

Expand Down Expand Up @@ -64,7 +64,7 @@ type
static function CLKernelArgConstant.FromCLValue<T>(cl_val: CommandQueue<CLValue<T>>): CLKernelArgConstant; where T: record;
begin Result := new CLKernelArgConstantCLValue<T>(cl_val) end;
static function CLKernelArgConstant.operator implicit<T>(cl_val: CLValueCCQ<T>): CLKernelArgConstant; where T: record;
begin Result := FromCLValue(cl_val as object as CommandQueue<CLValue<T>>) end;
begin Result := FromCLValue(cl_val) end;

{$endregion CLValue}

Expand Down Expand Up @@ -97,7 +97,7 @@ type
static function CLKernelArgConstant.FromCLArray<T>(cl_arr: CommandQueue<CLArray<T>>): CLKernelArgConstant; where T: record;
begin Result := new CLKernelArgConstantCLArray<T>(cl_arr) end;
static function CLKernelArgConstant.operator implicit<T>(cl_arr: CLArrayCCQ<T>): CLKernelArgConstant; where T: record;
begin Result := FromCLArray(cl_arr as object as CommandQueue<CLArray<T>>) end;
begin Result := FromCLArray(cl_arr) end;

{$endregion CLArray}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ begin Result := CLKernelArgPrivate.FromNativeArray(ntv_arr) end;
static function CLKernelArg.FromCLMemory(cl_mem: CommandQueue<CLMemory>): CLKernelArg;
begin Result := CLKernelArgGlobal.FromCLMemory(cl_mem) end;
static function CLKernelArg.operator implicit(cl_mem: CLMemoryCCQ): CLKernelArg;
begin Result := FromCLMemory(cl_mem as object as CommandQueue<CLMemory>) end;
begin Result := FromCLMemory(cl_mem) end;

{$endregion CLMemory}

Expand All @@ -99,7 +99,7 @@ begin Result := FromCLMemory(cl_mem as object as CommandQueue<CLMemory>) end;
static function CLKernelArg.FromCLValue<T>(cl_val: CommandQueue<CLValue<T>>): CLKernelArg; where T: record;
begin Result := CLKernelArgGlobal.FromCLValue(cl_val) end;
static function CLKernelArg.operator implicit<T>(cl_val: CLValueCCQ<T>): CLKernelArg; where T: record;
begin Result := FromCLValue(cl_val as object as CommandQueue<CLValue<T>>) end;
begin Result := FromCLValue(cl_val) end;

{$endregion CLValue}

Expand All @@ -108,7 +108,7 @@ begin Result := FromCLValue(cl_val as object as CommandQueue<CLValue<T>>) end;
static function CLKernelArg.FromCLArray<T>(cl_arr: CommandQueue<CLArray<T>>): CLKernelArg; where T: record;
begin Result := CLKernelArgGlobal.FromCLArray(cl_arr) end;
static function CLKernelArg.operator implicit<T>(cl_arr: CLArrayCCQ<T>): CLKernelArg; where T: record;
begin Result := FromCLArray(cl_arr as object as CommandQueue<CLArray<T>>) end;
begin Result := FromCLArray(cl_arr) end;

{$endregion CLArray}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type
static function CLKernelArgGlobal.FromCLMemory(cl_mem: CommandQueue<CLMemory>): CLKernelArgGlobal;
begin Result := new CLKernelArgGlobalCLMemory(cl_mem) end;
static function CLKernelArgGlobal.operator implicit(cl_mem: CLMemoryCCQ): CLKernelArgGlobal;
begin Result := FromCLMemory(cl_mem as object as CommandQueue<CLMemory>) end;
begin Result := FromCLMemory(cl_mem) end;

{$endregion CLMemory}

Expand Down Expand Up @@ -64,7 +64,7 @@ type
static function CLKernelArgGlobal.FromCLValue<T>(cl_val: CommandQueue<CLValue<T>>): CLKernelArgGlobal; where T: record;
begin Result := new CLKernelArgGlobalCLValue<T>(cl_val) end;
static function CLKernelArgGlobal.operator implicit<T>(cl_val: CLValueCCQ<T>): CLKernelArgGlobal; where T: record;
begin Result := FromCLValue(cl_val as object as CommandQueue<CLValue<T>>) end;
begin Result := FromCLValue(cl_val) end;

{$endregion CLValue}

Expand Down Expand Up @@ -97,7 +97,7 @@ type
static function CLKernelArgGlobal.FromCLArray<T>(cl_arr: CommandQueue<CLArray<T>>): CLKernelArgGlobal; where T: record;
begin Result := new CLKernelArgGlobalCLArray<T>(cl_arr) end;
static function CLKernelArgGlobal.operator implicit<T>(cl_arr: CLArrayCCQ<T>): CLKernelArgGlobal; where T: record;
begin Result := FromCLArray(cl_arr as object as CommandQueue<CLArray<T>>) end;
begin Result := FromCLArray(cl_arr) end;

{$endregion CLArray}

Expand Down
47 changes: 20 additions & 27 deletions Packing/Template/HighLvl/OpenCLABC/ContainerMethodData.pas
Original file line number Diff line number Diff line change
Expand Up @@ -448,13 +448,12 @@ function ArrLvl(self: MethodArgType): integer; extensionmethod :=
protected procedure WriteSpecialPreEnq(wr: Writer; settings: TSettings); virtual := exit;
protected procedure WriteSpecialPostEnq(wr: Writer; settings: TSettings); virtual := exit;

private procedure WriteParamInvokes(fn: string; max_arg_w: integer; settings: TSettings);
private procedure WriteParamInvokes(fn: string; max_non_arr_cq_arg_w: integer; settings: TSettings);
begin
//TODO #2654
var invokeable_args :=
settings.args?.&Where(arg->(settings as MethodSettings).arg_usage.ContainsKey(arg.name) and arg.t.IsCQ)
.Concat(GetSpecialInvokeResVars(settings)).ToArray
?? System.Array.Empty&<MethodArg>;
var invokeable_args := (
(settings.args?.&Where(arg->settings.arg_usage.ContainsKey(arg.name) and arg.t.IsCQ) ?? System.Array.Empty&<MethodArg>)
+ GetSpecialInvokeResVars(settings)
).ToArray;

if invokeable_args.Length=0 then exit;

Expand All @@ -469,7 +468,7 @@ function ArrLvl(self: MethodArgType): integer; extensionmethod :=
res_EIm += ';'#10;
continue;
end;
res_EIm += arg.name.PadLeft(max_arg_w);
res_EIm += if arg.t.ArrLvl<>0 then arg.name else arg.name.PadLeft(max_non_arr_cq_arg_w);
res_EIm += '_qr: ';

var t := arg.t;
Expand All @@ -490,8 +489,7 @@ function ArrLvl(self: MethodArgType): integer; extensionmethod :=
break;

res_EIm += 'QueueRes';
//TODO #2654
if (settings as MethodSettings).arg_usage[arg.name]='ptr' then
if settings.arg_usage[arg.name]='ptr' then
res_EIm += 'Ptr';
res_EIm += '<';
res_EIm += MethodArgTypeCQ(t).next.org_text;
Expand All @@ -506,8 +504,7 @@ function ArrLvl(self: MethodArgType): integer; extensionmethod :=

var WriteArgInvoke := procedure(arg: MethodArg; to_ptr: boolean)->
begin
//TODO #2654
if to_ptr <> ((settings as MethodSettings).arg_usage[arg.name]='ptr') then exit;
if to_ptr <> (settings.arg_usage[arg.name]='ptr') then exit;

res_EIm += ' ';
if arg.t is MethodArgTypeBasic then
Expand All @@ -516,9 +513,7 @@ function ArrLvl(self: MethodArgType): integer; extensionmethod :=
exit;
end;

var res_EIm := res_EIm; //TODO #???? (issue с 3 переменными)

res_EIm += arg.name.PadLeft(max_arg_w);
res_EIm += if arg.t.ArrLvl<>0 then arg.name else arg.name.PadLeft(max_non_arr_cq_arg_w);
res_EIm += '_qr := ';

var arg_name := arg.name;
Expand All @@ -536,8 +531,7 @@ function ArrLvl(self: MethodArgType): integer; extensionmethod :=
end;

res_EIm += 'invoker.InvokeBranch(';
//TODO Вместо max_arg_w тут надо что то отдельное, потому что не все проходят это условие
res_EIm += if arg.t.ArrLvl<>0 then arg_name else arg_name.PadLeft(max_arg_w);
res_EIm += if arg.t.ArrLvl<>0 then arg_name else arg_name.PadLeft(max_non_arr_cq_arg_w);
res_EIm += '.Invoke';
res_EIm += to_ptr ? 'ToPtr' : 'ToAny';
res_EIm += ', par_err_handlers, ';
Expand Down Expand Up @@ -570,7 +564,7 @@ function ArrLvl(self: MethodArgType): integer; extensionmethod :=

end;

private procedure WriteCommandTypeInvoke(fn: string; max_arg_w: integer; settings: TSettings);
private procedure WriteCommandTypeInvoke(fn: string; max_non_arr_cq_arg_w: integer; settings: TSettings);
begin
WriteInvokeHeader(settings);
res_EIm += ' begin'#10;
Expand All @@ -580,7 +574,7 @@ function ArrLvl(self: MethodArgType): integer; extensionmethod :=
if not settings.arg_usage.ContainsKey(arg.name) then
Otp($'WARNING: arg [{arg.name}] is defined for {fn}({settings.args_str}), but never used');

WriteParamInvokes(fn, max_arg_w, settings);
WriteParamInvokes(fn, max_non_arr_cq_arg_w, settings);

res_EIm += ' '#10;

Expand All @@ -596,7 +590,7 @@ function ArrLvl(self: MethodArgType): integer; extensionmethod :=
if not arg.t.IsCQ then continue;

res_EIm += ' ';
res_EIm += arg.name.PadLeft(max_arg_w);
res_EIm += if arg.t.ArrLvl<>0 then arg.name else arg.name.PadLeft(max_non_arr_cq_arg_w);
res_EIm += '_qr';

for var i := 1 to arg.t.ArrLvl do
Expand Down Expand Up @@ -636,9 +630,9 @@ function ArrLvl(self: MethodArgType): integer; extensionmethod :=
if not arg.t.IsCQ then continue;

res_EIm += ' var ';
res_EIm += arg.name.PadLeft(max_arg_w);
res_EIm += if arg.t.ArrLvl<>0 then arg.name else arg.name.PadLeft(max_non_arr_cq_arg_w);
res_EIm += ' := ';
res_EIm += arg.name.PadLeft(max_arg_w);
res_EIm += if arg.t.ArrLvl<>0 then arg.name else arg.name.PadLeft(max_non_arr_cq_arg_w);
res_EIm += '_qr';

for var i := 1 to arg.t.ArrLvl do
Expand Down Expand Up @@ -820,6 +814,7 @@ function ArrLvl(self: MethodArgType): integer; extensionmethod :=
{$region field's}

var max_arg_w := settings.args=nil ? 0 : settings.args.Max(arg->arg.name.Length);
var max_non_arr_cq_arg_w := settings.args=nil ? 0 : settings.args.Where(arg->arg.t.ArrLvl=0).Where(arg->arg.t.IsCQ).Select(arg->arg.name.Length).DefaultIfEmpty.Max;

var val_ptr_args := new HashSet<string>;
if settings.args<>nil then
Expand Down Expand Up @@ -981,7 +976,7 @@ function ArrLvl(self: MethodArgType): integer; extensionmethod :=
vname := nvname;
end;

res_EIm += arg.t is MethodArgTypeArray ? vname : vname.PadLeft(max_arg_w);
res_EIm += if arg.t.ArrLvl<>0 then vname else vname.PadLeft(max_non_arr_cq_arg_w);
res_EIm += '.InitBeforeInvoke(g, prev_hubs);'#10;
end;

Expand All @@ -992,7 +987,7 @@ function ArrLvl(self: MethodArgType): integer; extensionmethod :=

{$endregion InitBeforeInvoke}

WriteCommandTypeInvoke(fn, max_arg_w, settings);
WriteCommandTypeInvoke(fn, max_non_arr_cq_arg_w, settings);
res_EIm += ' '#10;

{$region ToStringImpl}
Expand Down Expand Up @@ -1194,8 +1189,7 @@ function ArrLvl(self: MethodArgType): integer; extensionmethod :=
res_EIm += t;
res_EIm += 'Command';
res_EIm += tn;
//TODO #2654
if generics.Count+(settings as MethodSettings).generics.Count <> 0 then
if generics.Count+settings.generics.Count <> 0 then
begin
res_EIm += '<';
res_EIm += generics.Select(g->g[0]).Concat(settings.generics).JoinToString(', ');
Expand All @@ -1204,8 +1198,7 @@ function ArrLvl(self: MethodArgType): integer; extensionmethod :=
if settings.impl_args<>nil then
begin
res_EIm += '(';
//TODO #2654
res_EIm += (settings as MethodSettings).impl_args.JoinToString(', ');
res_EIm += settings.impl_args.JoinToString(', ');
res_EIm += ')';
end;
end, settings);
Expand Down
Loading

0 comments on commit 63f60a1

Please sign in to comment.