This repository has been archived by the owner on Sep 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
consonoso.lpr
96 lines (81 loc) · 2.74 KB
/
consonoso.lpr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
program consonoso;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
Classes, sysutils, consonosounit,nosoblock,Noso_TUI,nosodebug,nosoconsensus
{ you can add units after this };
var
counter : integer;
EndApp : boolean = false;
Procedure NewLine(LText:String);
Begin
Writeln(LText);
End;
{$REGION TUI}
Procedure DrawScreen();
Begin
SetCursorMode(curhide);
Cls(1,1,80,25);
DWindow(1,1,80,12,'Consonoso',white,blue);
DWindow(1,12,80,24,'Console',white,blue);
VertLine(27,1,12,white,blue,true);
VertLine(54,1,12,white,blue,true);
SetConsole(2,13,79,23,white,black);
CreateControl('P_Merkle','Merkle',2,2,8,white,black,alleft);
CreateControl('P_Head','Head',2,3,8,white,black,alleft);
CreateControl('P_Block','Block',2,4,8,white,black,alleft);
CreateControl('P_LBHash','LBHash',2,5,8,white,black,alleft);
CreateControl('P_Summary','Summary',2,6,8,white,black,alleft);
CreateControl('P_PSOs','PSOs',2,7,8,white,black,alleft);
CreateControl('P_CFG','CFG',2,8,8,white,black,alleft);
CreateControl('P_GVTs','GVTs',2,9,8,white,black,alleft);
CreateControl('P_MNs','MNodes',2,10,8,white,black,alleft);
CreateControl('P_MNsCount','MNodes#',2,11,8,white,black,alleft);
CreateControl('l_Merkle','',10,2,15,black,white,AlCenter);
CreateControl('l_Head','',10,3,15,black,white,AlCenter);
CreateControl('l_Block','',10,4,15,black,white,AlCenter);
CreateControl('l_LBHash','',10,5,15,black,white,AlCenter);
CreateControl('l_Summary','',10,6,15,black,white,AlCenter);
CreateControl('l_PSOs','',10,7,15,black,white,AlCenter);
CreateControl('l_CFG','',10,8,15,black,white,AlCenter);
CreateControl('l_GVTs','',10,9,15,black,white,AlCenter);
CreateControl('l_MNs','',10,10,15,black,white,AlCenter);
CreateControl('l_MNsCount','',10,11,15,black,white,AlCenter);
CreateControl('clock','00',55,25,25,yellow,black,alright);
End;
{$ENDREGION TUI}
Procedure Haltapp(Message:String);
Begin
NewLine(Message);
NewLine('Program exited');
End;
Begin
for counter := 1 to paramCount() do
begin
if UpperCase(paramStr(counter)) = '-TUI' then UseTUI := true;
end;
If UseTUI then
begin
InitializeTUI;
DrawScreen;
TUIThread := ThreadTUI.create(true);
TUIThread.FreeOnTerminate:=true;
//TUIThread.Start;
end;
if VerifyStructure>0 then HaltApp('Error verifying the file struture');
UpdateThread := ThreadUpdate.create(true);
UpdateThread.FreeOnTerminate:=true;
UpdateThread.Start;
ToLog('console','Files structure verified');
InitSettings();
ToLog('console','Settings loaded');
InitFiles();
StartAutoConsensus();
If UseTUI then TUIThread.Start;
ToLog('console','Press enter to finish');
Readln();
UpdateThread.Terminate;
UpdateThread.WaitFor;
End. // End program