KoW for console applications added

This commit is contained in:
2021-01-08 18:39:17 +03:00
parent 305cd924f7
commit 5f3fca1705
29 changed files with 824 additions and 134 deletions

View File

@@ -1,5 +1,6 @@
[Directories]
OutputDir=..\..\..\Bin
UnitOutputDir=..\..\..\Bin\DCU
SearchPath=..\..\..\Lib;..\..\..\Bin\DCU
OutputDir=..\..\..\Bin\KoW
UnitOutputDir=..\..\..\Bin\KoW\DCU
SearchPath=..\..\..\Lib;..\..\..\Bin\KoW\DCU
UnitAliases=
UsePackages=0

View File

@@ -7,14 +7,16 @@ var
CharLine: array[$0..$F] of KolibriChar;
Line, Ch: Byte;
begin
InitConsole('Character map');
InitConsole('CharMap', False, 20, 19, 20, 19);
con_write_asciiz(' ');
con_write_asciiz(#10);
con_write_asciiz(' ');
con_write_string(HexDigits, Length(HexDigits));
con_write_asciiz(#10);
for Line := Low(HexDigits) to High(HexDigits) do
begin
con_write_asciiz(' ');
con_write_string(@HexDigits[Line], 1);
con_write_asciiz(' ');
for Ch := Low(CharLine) to High(CharLine) do

View File

@@ -13,7 +13,7 @@ var
Color: Byte;
begin
InitConsole('Console Colors');
InitConsole('Console Colors', False, 30, 33, 30, 33);
for Color := Low(ColorName) to High(ColorName) do
begin

View File

@@ -7,20 +7,18 @@ var
CursorXY: TCursorXY;
begin
InitConsole('Date/Time');
InitConsole('Date/Time', True, 80, 25, 80, 25);
CursorOff;
GotoXY(27, 11);
GotoXY(27, 12);
Write(
'System Date and System Time'#10 +
' '
' '
);
CursorXY := WhereXY;
repeat
with GetSystemDate do
con_printf('%02x.%02x.%02x', Day, Month, Year);
with GetSystemTime do
con_printf(' - %02x:%02x:%02x', Hours, Minutes, Seconds);
with GetSystemDate, GetSystemTime do
con_printf('%02x.%02x.%02x - %02x:%02x:%02x', Day, Month, Year, Hours, Minutes, Seconds);
GotoXY(CursorXY);
Delay(500);
until KeyPressed;

View File

@@ -3,12 +3,19 @@ program LoadFileApp;
uses
KolibriOS, CRT;
const
{$IFDEF KolibriOS}
FileName = '/sys/example.asm';
{$ELSE}
FileName = '..\..\Lib\KoW\CRT.inc';
{$ENDIF}
var
FileSize: LongWord;
Buffer: Pointer;
Buffer: PKolibriChar;
begin
InitConsole('Load File');
Buffer := LoadFile('/sys/example.asm', FileSize);
Buffer := LoadFile(FileName, FileSize);
con_write_string(Buffer, FileSize);
end.

View File

@@ -4,45 +4,38 @@ uses
KolibriOS, CRT, SysUtils;
const
FolderPath = '/sys';
Path = '/sys';
var
FolderInformation: TFolderInformation;
Info: TFolderInformation;
BlocksRead: LongWord;
Pos: LongWord;
begin
InitConsole('Read Folder');
if ReadFolder(FolderPath, FolderInformation, 0, 0, 0, BlocksRead) = 0 then
with FolderInformation do
con_printf('Folder "%s" contains %u files and/or folders.'#10#10, FolderPath, FileCount)
if ReadFolder(Path, Info, 0, 0, 0, BlocksRead) = 0 then
con_printf('Folder "%s" contains %u files and/or folders.'#10#10, Path, Info.FileCount)
else
con_printf('Folder "%s" can not be read.'#10, FolderPath);
con_printf('Folder "%s" cannot be read.'#10, Path);
Pos := 0;
while ReadFolder(FolderPath, FolderInformation, 1, Pos, 0, BlocksRead) = 0 do
while ReadFolder(Path, Info, 1, Pos, 0, BlocksRead) = 0 do
begin
with FolderInformation, FileInformation[0] do
with Info, FileInformation[0] do
begin
con_printf( 'File Name = %s'#10, Name);
con_printf( 'File Name = %s'#10, Name);
with Attributes do
begin
con_printf( 'SizeLo = %u'#10, Int64Rec(Size).Lo);
con_printf( 'SizeHi = %u'#10, Int64Rec(Size).Hi);
with Modify.Date do
con_printf('Modify Date = %02d.%02d.%02d'#10, Day, Month, Year);
with Modify.Time do
con_printf('Modify Time = %02d:%02d:%02d'#10, Hours, Minutes, Seconds);
with Access.Date do
con_printf('Access Date = %02d.%02d.%02d'#10, Day, Month, Year);
with Access.Time do
con_printf('Access Time = %02d:%02d:%02d'#10, Hours, Minutes, Seconds);
with Creation.Date do
con_printf('Creation Date = %02d.%02d.%02d'#10, Day, Month, Year);
with Creation.Time do
con_printf('Creation Time = %02d:%02d:%02d'#10, Hours, Minutes, Seconds);
con_printf( 'Attributes = 0x%08x'#10#10, Attributes);
with Int64Rec(Size) do
con_printf('Size = %u:%u'#10, Hi, Lo);
with Creation, Date, Time do
con_printf('Created = %02d.%02d.%02d %02d:%02d:%02d'#10, Day, Month, Year, Hours, Minutes, Seconds);
with Modify, Date, Time do
con_printf('Modified = %02d.%02d.%02d %02d:%02d:%02d'#10, Day, Month, Year, Hours, Minutes, Seconds);
with Access, Date, Time do
con_printf('Accessed = %02d.%02d.%02d %02d:%02d:%02d'#10, Day, Month, Year, Hours, Minutes, Seconds);
con_printf( 'Attributes = 0x%08x'#10#10, Attributes);
end;
end;
Inc(Pos);

View File

@@ -1,3 +1,8 @@
@echo off
call "%~dp0..\..\..\Tools\build.bat" "%~dp0DrawImage"
copy "%~dp0*.tga" "%~dp0..\..\..\Bin" >nul
if errorlevel 1 goto exit
call "%~dp0init.bat"
:exit

View File

@@ -0,0 +1,11 @@
@echo off
for %%f in ("%~dp0*.tga") do (
if not exist "%~dp0..\..\..\Bin\%1\%%~nxf" (
echo Copying "%%f"
copy "%%f" "%~dp0..\..\..\Bin\%1" >nul
if errorlevel 1 goto exit
)
)
:exit

View File

@@ -1,3 +1,8 @@
@echo off
call "%~dp0..\..\..\Tools\build.bat" "%~dp0DrawImageEx"
copy "%~dp0*.bmp" "%~dp0..\..\..\Bin" >nul
if errorlevel 1 goto exit
call "%~dp0init.bat"
:exit

View File

@@ -0,0 +1,11 @@
@echo off
for %%f in ("%~dp0*.bmp") do (
if not exist "%~dp0..\..\..\Bin\%1\%%~nxf" (
echo Copying "%%f"
copy "%%f" "%~dp0..\..\..\Bin\%1" >nul
if errorlevel 1 goto exit
)
)
:exit

View File

@@ -1,3 +1,8 @@
@echo off
call "%~dp0..\..\..\Tools\build.bat" "%~dp0SetCursor"
copy "%~dp0*.bmp" "%~dp0..\..\..\Bin" >nul
if errorlevel 1 goto exit
call "%~dp0init.bat"
:exit

View File

@@ -0,0 +1,11 @@
@echo off
for %%f in ("%~dp0*.bmp") do (
if not exist "%~dp0..\..\..\Bin\%1\%%~nxf" (
echo Copying "%%f"
copy "%%f" "%~dp0..\..\..\Bin\%1" >nul
if errorlevel 1 goto exit
)
)
:exit