Skip to content

Commit 685e97c

Browse files
committed
refactor: Output to STDOUT in sbalazs
1 parent 14b6b95 commit 685e97c

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

entries/sbalazs/src/obrc.lpr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ procedure DoOnFinish(Sender: TObject);
4444
Halt;
4545
end;
4646

47-
if (Trim(ParamStr(2)) = '') then
47+
{if (Trim(ParamStr(2)) = '') then
4848
begin
4949
Writeln('Please specify a valid destination file');
5050
Halt;
51-
end;
51+
end;}
5252

53-
if (Trim(ParamStr(3)) <> '') then
53+
if (Trim(ParamStr(2)) <> '') then
5454
TC := StrToIntDef(ParamStr(3), 16)
5555
else
5656
TC := 16;
5757

58-
FWSManager := TWSManager.Create(ParamStr(1), ParamStr(2), TC);
58+
FWSManager := TWSManager.Create(ParamStr(1), TC);
5959
MStart.Data := nil;
6060
MStart.Code := @DoOnStart;
6161
FWSManager.OnStart := TNotifyEvent(MStart);

entries/sbalazs/src/uweatherstations.pas

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ TWSThreadsWatcher = class(TWSThreadBase)
8080
constructor Create(AWSManager: TWSManager);
8181
end;
8282

83+
{ TWSManager }
84+
8385
TWSManager = class
8486
private
8587
FSrcFile: String;
86-
FDstFile: String;
8788
FThreadCnt: Integer;
8889
FTerminated: Boolean;
8990
FThreadList: TLockList;
@@ -92,7 +93,7 @@ TWSManager = class
9293
FOnStart: TNotifyEvent;
9394
FOnFinish: TNotifyEvent;
9495
public
95-
constructor Create(ASrcFile, ADstFile: String; AThreadCnt: Integer);
96+
constructor Create(ASrcFile: String; AThreadCnt: Integer);
9697
destructor Destroy; override;
9798
public
9899
property WSThreadsWatcher: TWSThreadsWatcher read FWSThreadsWatcher;
@@ -414,7 +415,7 @@ procedure TWSThreadsWatcher.CreateFinalList;
414415
Str: String;
415416
WS: PWS;
416417
SL: TStringList;
417-
MS: TMemoryStream;
418+
// MS: TMemoryStream;
418419
begin
419420
SL := TStringList.Create;
420421
try
@@ -440,14 +441,20 @@ procedure TWSThreadsWatcher.CreateFinalList;
440441
Str := Trim(Str);
441442
Delete(Str, Length(Str), 1);
442443
Str := '{' + Str + '}';
443-
MS := TMemoryStream.Create;
444-
try
445-
MS.Write(Pointer(Str)^, Length(Str) div SizeOf(Char));
446-
MS.Position := 0;
447-
MS.SaveToFile(FWSManager.FDstFile);
448-
finally
449-
MS.Free;
450-
end;
444+
Str := StringReplace(Str, sLineBreak, ' ', [rfReplaceAll]);
445+
Writeln(Str);
446+
447+
//Str := Trim(Str);
448+
//Delete(Str, Length(Str), 1);
449+
//Str := '{' + Str + '}';
450+
//MS := TMemoryStream.Create;
451+
//try
452+
// MS.Write(Pointer(Str)^, Length(Str) div SizeOf(Char));
453+
// MS.Position := 0;
454+
// MS.SaveToFile(FWSManager.FDstFile);
455+
//finally
456+
// MS.Free;
457+
//end;
451458
end;
452459

453460
procedure TWSThreadsWatcher.Execute;
@@ -497,10 +504,9 @@ procedure TWSThreadsWatcher.Execute;
497504
end;
498505

499506
{ TWSManager }
500-
constructor TWSManager.Create(ASrcFile, ADstFile: String; AThreadCnt: Integer);
507+
constructor TWSManager.Create(ASrcFile: String; AThreadCnt: Integer);
501508
begin
502509
FSrcFile := ASrcFile;
503-
FDstFile := ADstFile;
504510
FThreadCnt := AThreadCnt;
505511
FTerminated := False;
506512
FThreadList := TLockList.Create;

0 commit comments

Comments
 (0)