Skip to content

Commit

Permalink
Pull upstream and update compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
SunSerega committed Mar 22, 2024
1 parent 8fb6f3c commit 47049b8
Show file tree
Hide file tree
Showing 134 changed files with 8,454 additions and 7,517 deletions.
2 changes: 1 addition & 1 deletion DataScraping/Reps/OpenCL-Docs
Submodule OpenCL-Docs updated from a8f8b4 to 5a3019
Binary file modified DataScraping/XML/Dummy/funcs.bin
Binary file not shown.
11 changes: 6 additions & 5 deletions DataScraping/XML/ItemSources.pas
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface
private static aaaaa := constructor_hotfix;
// static constructor;

protected static function MakeName<TFullName>(api, s, api_beg: string; allow_nil: boolean; api_underscore_sep: boolean?; known_suffixes: HashSet<string>; params suffix_formats: array of string): TFullName;
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>;
begin
Result := nil;
Expand All @@ -34,17 +34,18 @@ interface
if ctor=nil then
raise new NotImplementedException(TypeToTypeName(typeof(TFullName)));

if s=nil then
if string.IsNullOrEmpty(s) then
begin
if not allow_nil then
raise nil;
exit;
end;

if allow_nil then
if not s.ToLower.StartsWith(api_beg) or (api_underscore_sep = not s.Remove(0,api_beg.Length).StartsWith('_')) then
begin
if not s.ToLower.StartsWith(api_beg) then exit;
if api_underscore_sep = not s.Remove(0,api_beg.Length).StartsWith('_') then exit;
if not skip_invalid then
raise new System.InvalidOperationException(s);
exit;
end;

var extract_suffix: Func<string, ValueTuple<string,string>> := l_name->
Expand Down
42 changes: 41 additions & 1 deletion DataScraping/XML/NamedItems.pas
Original file line number Diff line number Diff line change
Expand Up @@ -481,13 +481,53 @@

{$endregion MultiKindItem}

procedure WriteBinIndices<T>(self: BinWriter; l: IList<T>); extensionmethod; where T: IBinIndexable;
procedure WriteNullable<T>(self: BinWriter; o: T; write: (BinWriter,T)->()); extensionmethod;
begin
self.Write(o<>nil);
if o=nil then exit;
write(self,o);
end;

procedure WriteNullable<T>(self: BinWriter; o: T; write: T->()); extensionmethod;
begin
self.Write(o<>nil);
if o=nil then exit;
write(o);
end;

procedure WriteBinIndexOrNil<T>(self: BinWriter; o: T); extensionmethod; where T: IBinIndexable;
begin
self.Write(if o=nil then -1 else o.BinIndex);
end;

procedure WriteBinIndexArr<T>(self: BinWriter; l: IList<T>); extensionmethod; where T: IBinIndexable;
begin
self.Write(l.Count);
foreach var o in l.Order do
self.Write(o.BinIndex);
end;

procedure WriteAnyBinIndexOrNil<T1,T2>(self: BinWriter; t: (T1,T2)); extensionmethod; where T1,T2: IBinIndexable;
begin
var any_done := false;
var type_ind := 0;
var add := procedure(o: IBinIndexable)->
begin
type_ind += 1;
if o=nil then exit;

if any_done then raise new System.InvalidOperationException($'Multiple non-nil items in {_ObjectToString(t)}');
any_done := true;

self.Write(type_ind);
self.Write(o.BinIndex);
end;
add(t.Item1);
add(t.Item2);
if not any_done then
self.Write(0);
end;

initialization
finalization
try
Expand Down
Loading

0 comments on commit 47049b8

Please sign in to comment.