ConBoard example application added

This commit is contained in:
2021-01-06 07:25:52 +03:00
parent 5343d74f97
commit 8759ae0881
3 changed files with 74 additions and 3 deletions

View File

@@ -0,0 +1,67 @@
program ConBoard;
uses
CRT, KolibriOS;
var
LogFilePath: PKolibriChar = '/tmp0/1/BOARDLOG.TXT';
Ch: KolibriChar;
Prefix: array[0..3] of KolibriChar; // #0#0#0#0 by program start
PrefixIndex: LongWord = 0; // 0 by program start but warning
IsStartLine: Boolean = True;
Attr: TFileAttributes;
BytesWritten: LongWord;
begin
InitConsole('Console board');
if CmdLine^ <> #0 then
LogFilePath := CmdLine;
repeat
if DebugRead(Ch) then
begin
if IsStartLine then
begin
Prefix[PrefixIndex] := Ch;
if PrefixIndex = High(Prefix) - 1 then
begin
// Kernel
if (Prefix[0] = 'K') and (Prefix[1] = ' ') and (Prefix[2] = ':') then
TextColor(Yellow)
else
// Launcher
if (Prefix[0] = 'L') and (Prefix[1] = ':') and (Prefix[2] = ' ') then
TextColor(White)
else
TextColor(LightGray);
IsStartLine := False;
PrefixIndex := Low(Prefix);
with GetSystemTime do
con_printf('[%02x:%02x:%02x] ', Hours, Minutes, Seconds);
con_write_asciiz(Prefix);
LongWord(Prefix) := 0; // Prefix := #0#0#0#0;
end
else
Inc(PrefixIndex);
end
else
begin
con_write_string(@Ch, 1);
if Ch = #10 then
begin
IsStartLine := True;
TextColor(LightGray);
end;
end;
if GetFileAttributes(LogFilePath, Attr) = ERROR_FILE_NOT_FOUND then
begin
CreateFile(LogFilePath);
Attr.Size := 0;
end;
WriteFile(LogFilePath, Ch, SizeOf(Ch), Attr.Size, BytesWritten);
end;
until LongBool(con_get_flags and CON_WINDOW_CLOSED);
end.

View File

@@ -0,0 +1 @@
@call "%~dp0..\..\..\Tools\build.bat" "%~dp0ConBoard"

View File

@@ -9,9 +9,9 @@ MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
DCC = $(ROOT)\bin\dcc32.exe $** DCC = $(ROOT)\bin\dcc32.exe $**
BRCC = $(ROOT)\bin\brcc32.exe $** BRCC = $(ROOT)\bin\brcc32.exe $**
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
PROJECTS = CharMap.exe ColorButtons.exe ConsoleColors.exe DateTime.exe DrawImage.exe DrawImageEx.exe DrawText.exe \ PROJECTS = CharMap.exe ColorButtons.exe ConBoard.exe ConsoleColors.exe DateTime.exe DrawImage.exe DrawImageEx.exe \
Echo.exe GetCurrentDirectory.exe GetPixel.exe GetPointOwner.exe Hello.exe HelloGUI.exe LoadFile.exe ReadFolder.exe \ DrawText.exe Echo.exe GetCurrentDirectory.exe GetPixel.exe GetPointOwner.exe Hello.exe HelloGUI.exe LoadFile.exe \
Screenshot.exe SetCursor.exe SetPixel.exe SetWindowPos.exe ReadFolder.exe Screenshot.exe SetCursor.exe SetPixel.exe SetWindowPos.exe
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
default: $(PROJECTS) default: $(PROJECTS)
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@@ -22,6 +22,9 @@ CharMap.exe: Console\CharMap\CharMap.dpr
ColorButtons.exe: GUI\ColorButtons\ColorButtons.dpr ColorButtons.exe: GUI\ColorButtons\ColorButtons.dpr
$(DCC) $(DCC)
ConBoard.exe: Console\ConBoard\ConBoard.dpr
$(DCC)
ConsoleColors.exe: Console\ConsoleColors\ConsoleColors.dpr ConsoleColors.exe: Console\ConsoleColors\ConsoleColors.dpr
$(DCC) $(DCC)