Skip to content

Commit 964baa2

Browse files
committed
refactor: Script Builder changes
- Use of variables on the bash script - Script Builder now has functions for Header, Variables and bash functions
1 parent 051cfc7 commit 964baa2

3 files changed

Lines changed: 242 additions & 194 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ I'd like to thank [@mobius](https://github.com/mobius1qwe) for taking the time t
224224
I'd like to thank [@dtpfl](https://github.com/dtpfl) for his invaluable work on maintaining the `README.md` file up to date with everything.\
225225
I'd like to thank Székely Balázs for providing many patches to make everything compliant with the original challenge.\
226226
I'd like to thank [@corneliusdavid](https://github.com/corneliusdavid) for giving some of the information files a once over and making things more legible and clear.\
227-
I'd like to thank Mr. **Pack**man, aka O, for clearing the fog around the rounding issues.
227+
I'd like to thank Mr. **Pack**man, aka O, for clearing the fog around the rounding issues.\
228+
I'd like to thank [Georges](https://github.com/georges-hatem) for providing us with the Delphi version of baseline.
228229

229230
## Links
230231
The original repository: https://github.com/gunnarmorling/1brc \

utilities/common/utilities.data.config.pas

Lines changed: 67 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -31,48 +31,74 @@ interface
3131
{ TConfig }
3232
TConfig = class(TObject)
3333
private
34-
FRootFolder: TJSONStringType;
35-
FEntriesFolder: TJSONStringType;
34+
FRootLinux: TJSONStringType;
35+
FRootWindows: TJSONStringType;
36+
37+
FEntriesLinux: TJSONStringType;
38+
FEntriesWindows: TJSONStringType;
39+
3640
FResultsFolder: TJSONStringType;
37-
FBinFolder: TJSONStringType;
41+
42+
FBinLinux: TJSONStringType;
43+
FBinWindows: TJSONStringType;
44+
3845
FInput: TJSONStringType;
3946
FHyperfine: TJSONStringType;
47+
4048
FLazbuild: TJSONStringType;
49+
FDelphiCompiler: TJSONStringType;
50+
4151
FOutputHash: TJSONStringType;
4252
FEntries: TEntries;
4353

44-
//procedure setFromJSON(const AJSON: TJSONStringType);
4554
procedure setFromJSONData(const AJSONData: TJSONData);
4655
procedure setFromJSONObject(const AJSONObject: TJSONObject);
4756
protected
4857
public
4958
constructor Create;
50-
//constructor Create(const AJSON: TJSONStringType);
5159
constructor Create(const AJSONData: TJSONData);
5260

5361
destructor Destroy; override;
5462

55-
property RootFolder: TJSONStringType
56-
read FRootFolder
57-
write FRootFolder;
58-
property EntriesFolder: TJSONStringType
59-
read FEntriesFolder
60-
write FEntriesFolder;
63+
property RootLinux: TJSONStringType
64+
read FRootLinux
65+
write FRootLinux;
66+
property RootWindows: TJSONStringType
67+
read FRootWindows
68+
write FRootWindows;
69+
70+
property EntriesLinux: TJSONStringType
71+
read FEntriesLinux
72+
write FEntriesLinux;
73+
property EntriesWindows: TJSONStringType
74+
read FEntriesWindows
75+
write FEntriesWindows;
76+
6177
property ResultsFolder: TJSONStringType
6278
read FResultsFolder
6379
write FResultsFolder;
64-
property BinFolder: TJSONStringType
65-
read FBinFolder
66-
write FBinFolder;
80+
81+
property BinLinux: TJSONStringType
82+
read FBinLinux
83+
write FBinLinux;
84+
property BinWindows: TJSONStringType
85+
read FBinWindows
86+
write FBinWindows;
87+
6788
property Input: TJSONStringType
6889
read FInput
6990
write FInput;
7091
property Hyperfine: TJSONStringType
7192
read FHyperfine
7293
write FHyperfine;
94+
7395
property Lazbuild: TJSONStringType
7496
read FLazbuild
7597
write FLazbuild;
98+
property DelphiCompiler: TJSONStringType
99+
read FDelphiCompiler
100+
write FDelphiCompiler;
101+
76102
property OutputHash: TJSONStringType
77103
read FOutputHash
78104
write FOutputHash;
@@ -84,15 +110,19 @@ TConfig = class(TObject)
84110
implementation
85111

86112
const
87-
cJSONRootFolder = 'root-folder';
88-
cJSONEntriesFolder = 'entries-folder';
89-
cJSONResultsFolder = 'results-folder';
90-
cJSONBinFolder = 'bin-folder';
91-
cJSONInput = 'input';
92-
cJSONHyperfine = 'hyperfine';
93-
cJSONLazbuild = 'lazbuild';
94-
cJSONOutpuHash = 'output-hash';
95-
cJSONEntries = 'entries';
113+
cJSONRootLinux = 'root-linux';
114+
cJSONRootWIndows = 'root-windows';
115+
cJSONEntriesLinux = 'entries-linux';
116+
cJSONEntriesWindows = 'entries-windows';
117+
cJSONResultsFolder = 'results-folder';
118+
cJSONBinLinux = 'bin-linux';
119+
cJSONBinWindows = 'bin-windows';
120+
cJSONInput = 'input';
121+
cJSONHyperfine = 'hyperfine';
122+
cJSONLazbuild = 'lazbuild';
123+
cJSONDelphiCompiler = 'delphi-compiler';
124+
cJSONOutpuHash = 'output-hash';
125+
cJSONEntries = 'entries';
96126

97127
resourcestring
98128
rsExceptionNotAJSONObject = 'JSON Data is not an object';
@@ -104,23 +134,20 @@ implementation
104134

105135
constructor TConfig.Create;
106136
begin
107-
FRootFolder:= '';
108-
FEntriesFolder:= '';
137+
FRootLinux:= '';
138+
FRootWindows:= '';
139+
FEntriesLinux:= '';
140+
FEntriesWindows:= '';
109141
FResultsFolder:= '';
110-
FBinFolder:= '';
142+
FBinLinux:= '';
143+
FBinWindows:= '';
111144
FInput:= '';
112145
FHyperfine:= '';
113146
FLazbuild:= '';
147+
FDelphiCompiler:= '';
114148
FOutputHash:= '';
115-
//FEntries:= TEntries.Create;
116149
end;
117150

118-
{constructor TConfig.Create(const AJSON: TJSONStringType);
119-
begin
120-
Create;
121-
setFromJSON(AJSON);
122-
end;}
123-
124151
constructor TConfig.Create(const AJSONData: TJSONData);
125152
begin
126153
Create;
@@ -133,28 +160,6 @@ destructor TConfig.Destroy;
133160
inherited Destroy;
134161
end;
135162

136-
{procedure TConfig.setFromJSON(const AJSON: TJSONStringType);
137-
var
138-
jData: TJSONData;
139-
begin
140-
if trim(AJSON) = EmptyStr then
141-
begin
142-
raise ENodeStatusEmptyString.Create(rsExceptionEmptyString);
143-
end;
144-
try
145-
jData:= GetJSON(AJSON);
146-
except
147-
on E: Exception do
148-
begin
149-
raise ENodeStatusCannotParse.Create(Format(rsExceptionCannotParse, [E.Message]));
150-
end;
151-
end;
152-
try
153-
setFromJSONData(jData);
154-
finally
155-
jData.Free;
156-
end;
157-
end;}
158163

159164
procedure TConfig.setFromJSONData(const AJSONData: TJSONData);
160165
begin
@@ -167,13 +172,17 @@ procedure TConfig.setFromJSONData(const AJSONData: TJSONData);
167172

168173
procedure TConfig.setFromJSONObject(const AJSONObject: TJSONObject);
169174
begin
170-
FRootFolder:= AJSONObject.Get(cJSONRootFolder, FRootFolder);
171-
FEntriesFolder:= AJSONObject.Get(cJSONEntriesFolder, FEntriesFolder);
175+
FRootLinux:= AJSONObject.Get(cJSONRootLinux, FRootLinux);
176+
FRootWindows:= AJSONObject.Get(cJSONRootWIndows, FRootWindows);
177+
FEntriesLinux:= AJSONObject.Get(cJSONEntriesLinux, FEntriesLinux);
178+
FEntriesWindows:= AJSONObject.Get(cJSONEntriesWindows, FEntriesWindows);
172179
FResultsFolder:= AJSONObject.Get(cJSONResultsFolder, FResultsFolder);
173-
FBinFolder:= AJSONObject.Get(cJSONBinFolder, FBinFolder);
180+
FBinLinux:= AJSONObject.Get(cJSONBinLinux, FBinLinux);
181+
FBinWindows:= AJSONObject.Get(cJSONBinWindows, FBinWindows);
174182
FInput:= AJSONObject.Get(cJSONInput, FInput);
175183
FHyperfine:= AJSONObject.Get(cJSONHyperfine, FHyperfine);
176184
FLazbuild:= AJSONObject.Get(cJSONLazbuild, FLazbuild);
185+
FDelphiCompiler:= AJSONObject.Get(cJSONDelphiCompiler, FDelphiCompiler);
177186
FOutputHash:= AJSONObject.Get(cJSONOutpuHash, FOutputHash);
178187
FEntries:= TEntries.Create(AJSONObject.Find(cJSONEntries));
179188
end;

0 commit comments

Comments
 (0)