mirror of
https://github.com/vapaamies/KolibriOS.git
synced 2025-09-21 02:30:07 +02:00
ConBoard example application added
This commit is contained in:
67
Examples/Console/ConBoard/ConBoard.dpr
Normal file
67
Examples/Console/ConBoard/ConBoard.dpr
Normal 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.
|
1
Examples/Console/ConBoard/build.bat
Normal file
1
Examples/Console/ConBoard/build.bat
Normal file
@@ -0,0 +1 @@
|
||||
@call "%~dp0..\..\..\Tools\build.bat" "%~dp0ConBoard"
|
@@ -9,9 +9,9 @@ MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
|
||||
DCC = $(ROOT)\bin\dcc32.exe $**
|
||||
BRCC = $(ROOT)\bin\brcc32.exe $**
|
||||
#------------------------------------------------------------------------------
|
||||
PROJECTS = CharMap.exe ColorButtons.exe ConsoleColors.exe DateTime.exe DrawImage.exe DrawImageEx.exe DrawText.exe \
|
||||
Echo.exe GetCurrentDirectory.exe GetPixel.exe GetPointOwner.exe Hello.exe HelloGUI.exe LoadFile.exe ReadFolder.exe \
|
||||
Screenshot.exe SetCursor.exe SetPixel.exe SetWindowPos.exe
|
||||
PROJECTS = CharMap.exe ColorButtons.exe ConBoard.exe ConsoleColors.exe DateTime.exe DrawImage.exe DrawImageEx.exe \
|
||||
DrawText.exe Echo.exe GetCurrentDirectory.exe GetPixel.exe GetPointOwner.exe Hello.exe HelloGUI.exe LoadFile.exe \
|
||||
ReadFolder.exe Screenshot.exe SetCursor.exe SetPixel.exe SetWindowPos.exe
|
||||
#------------------------------------------------------------------------------
|
||||
default: $(PROJECTS)
|
||||
#------------------------------------------------------------------------------
|
||||
@@ -22,6 +22,9 @@ CharMap.exe: Console\CharMap\CharMap.dpr
|
||||
ColorButtons.exe: GUI\ColorButtons\ColorButtons.dpr
|
||||
$(DCC)
|
||||
|
||||
ConBoard.exe: Console\ConBoard\ConBoard.dpr
|
||||
$(DCC)
|
||||
|
||||
ConsoleColors.exe: Console\ConsoleColors\ConsoleColors.dpr
|
||||
$(DCC)
|
||||
|
||||
|
Reference in New Issue
Block a user