mirror of
https://github.com/vapaamies/KolibriOS.git
synced 2024-09-21 02:11:07 +02:00
{$APPTYPE CONSOLE} support added
This commit is contained in:
parent
9888dd9095
commit
b52068a7f2
@ -4,9 +4,6 @@ uses
|
|||||||
KolibriOS, CRT;
|
KolibriOS, CRT;
|
||||||
|
|
||||||
const
|
const
|
||||||
AppPath = PPKolibriChar(32);
|
|
||||||
CmdLine = PPKolibriChar(28);
|
|
||||||
|
|
||||||
BUFFER_SIZE = 256;
|
BUFFER_SIZE = 256;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -17,7 +14,7 @@ begin
|
|||||||
|
|
||||||
GetCurrentDirectory(Buffer, BUFFER_SIZE);
|
GetCurrentDirectory(Buffer, BUFFER_SIZE);
|
||||||
|
|
||||||
con_printf('AppPath is "%s"'#10, AppPath^);
|
con_printf('Application Path is "%s"'#10, AppPath);
|
||||||
con_printf('CmdLine is "%s"'#10, CmdLine^);
|
con_printf('Command Line is "%s"'#10, CmdLine);
|
||||||
con_printf('Current Directory is "%s"'#10, Buffer);
|
con_printf('Current Directory is "%s"'#10, Buffer);
|
||||||
end.
|
end.
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
program Hello;
|
program Hello;
|
||||||
|
|
||||||
|
{$APPTYPE CONSOLE}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
CRT;
|
CRT;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
InitConsole('Hello');
|
|
||||||
WriteLn('Hello, world!');
|
WriteLn('Hello, world!');
|
||||||
end.
|
end.
|
||||||
|
@ -3,9 +3,6 @@ program DrawImageApp;
|
|||||||
uses
|
uses
|
||||||
KolibriOS;
|
KolibriOS;
|
||||||
|
|
||||||
const
|
|
||||||
AppPath = PPKolibriChar(32);
|
|
||||||
|
|
||||||
type
|
type
|
||||||
THeader = packed record
|
THeader = packed record
|
||||||
IDLength: Byte;
|
IDLength: Byte;
|
||||||
@ -59,8 +56,8 @@ var
|
|||||||
begin
|
begin
|
||||||
HeapInit;
|
HeapInit;
|
||||||
|
|
||||||
ExtractFileDirectory(AppPath^, AppPath^);
|
ExtractFileDirectory(AppPath, AppPath);
|
||||||
SetCurrentDirectory(AppPath^);
|
SetCurrentDirectory(AppPath);
|
||||||
|
|
||||||
TargaFile := LoadFile('Lena.tga', FileSize);
|
TargaFile := LoadFile('Lena.tga', FileSize);
|
||||||
|
|
||||||
|
@ -4,8 +4,6 @@ uses
|
|||||||
KolibriOS;
|
KolibriOS;
|
||||||
|
|
||||||
const
|
const
|
||||||
AppPath = PPKolibriChar(32);
|
|
||||||
|
|
||||||
Picture1 = 'Flower(4bpp).bmp';
|
Picture1 = 'Flower(4bpp).bmp';
|
||||||
Picture2 = 'Mario(1bpp).bmp';
|
Picture2 = 'Mario(1bpp).bmp';
|
||||||
Picture3 = 'House(24bpp).bmp';
|
Picture3 = 'House(24bpp).bmp';
|
||||||
@ -81,8 +79,8 @@ var
|
|||||||
begin
|
begin
|
||||||
HeapInit;
|
HeapInit;
|
||||||
|
|
||||||
ExtractFileDirectory(AppPath^, AppPath^);
|
ExtractFileDirectory(AppPath, AppPath);
|
||||||
SetCurrentDirectory(AppPath^);
|
SetCurrentDirectory(AppPath);
|
||||||
|
|
||||||
GetFileAttributes(Picture1, FileAttributes);
|
GetFileAttributes(Picture1, FileAttributes);
|
||||||
BitmapFile1 := HeapAllocate(FileAttributes.Size);
|
BitmapFile1 := HeapAllocate(FileAttributes.Size);
|
||||||
|
@ -4,8 +4,6 @@ uses
|
|||||||
KolibriOS;
|
KolibriOS;
|
||||||
|
|
||||||
const
|
const
|
||||||
AppPath = PPKolibriChar(32);
|
|
||||||
|
|
||||||
ARROW_BUTTON = 2;
|
ARROW_BUTTON = 2;
|
||||||
POINT_BUTTON = 3;
|
POINT_BUTTON = 3;
|
||||||
WAIT_BUTTON = 4;
|
WAIT_BUTTON = 4;
|
||||||
@ -74,8 +72,8 @@ var
|
|||||||
begin
|
begin
|
||||||
HeapInit;
|
HeapInit;
|
||||||
|
|
||||||
ExtractFileDirectory(AppPath^, AppPath^);
|
ExtractFileDirectory(AppPath, AppPath);
|
||||||
SetCurrentDirectory(AppPath^);
|
SetCurrentDirectory(AppPath);
|
||||||
|
|
||||||
ArrowBitmapFile := LoadFile('arrow.bmp', FileSize);
|
ArrowBitmapFile := LoadFile('arrow.bmp', FileSize);
|
||||||
PointBitmapFile := LoadFile('point.bmp', FileSize);
|
PointBitmapFile := LoadFile('point.bmp', FileSize);
|
||||||
|
@ -237,6 +237,9 @@ initialization
|
|||||||
Pointer(@con_write_asciiz) := GetProcAddress(hConsole, 'con_write_asciiz');
|
Pointer(@con_write_asciiz) := GetProcAddress(hConsole, 'con_write_asciiz');
|
||||||
Pointer(@con_write_string) := GetProcAddress(hConsole, 'con_write_string');
|
Pointer(@con_write_string) := GetProcAddress(hConsole, 'con_write_string');
|
||||||
|
|
||||||
|
if IsConsole then
|
||||||
|
InitConsole(AppPath);
|
||||||
|
|
||||||
finalization
|
finalization
|
||||||
if Assigned(con_exit) then
|
if Assigned(con_exit) then
|
||||||
con_exit(CloseWindow);
|
con_exit(CloseWindow);
|
||||||
|
@ -161,6 +161,7 @@ function _LStrToPChar(const S: KolibriString): PKolibriChar;
|
|||||||
var
|
var
|
||||||
IOResult: Integer;
|
IOResult: Integer;
|
||||||
Input, Output: Text;
|
Input, Output: Text;
|
||||||
|
IsConsole: Boolean;
|
||||||
|
|
||||||
function _Flush(var T: TTextRec): Integer;
|
function _Flush(var T: TTextRec): Integer;
|
||||||
procedure __IOTest;
|
procedure __IOTest;
|
||||||
@ -184,6 +185,9 @@ procedure _WriteString(var T: TTextRec; const S: ShortString; Width: LongInt);
|
|||||||
procedure _WriteLString(var T: TTextRec; const S: KolibriString; Width: LongInt);
|
procedure _WriteLString(var T: TTextRec; const S: KolibriString; Width: LongInt);
|
||||||
procedure _WriteLn(var T: TTextRec);
|
procedure _WriteLn(var T: TTextRec);
|
||||||
|
|
||||||
|
var
|
||||||
|
AppPath, CmdLine: PKolibriChar;
|
||||||
|
|
||||||
{ Console Library API }
|
{ Console Library API }
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -493,10 +497,13 @@ end;
|
|||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
|
||||||
asm // InitFPU
|
asm // InitFPU
|
||||||
FNINIT
|
FNINIT
|
||||||
FWAIT
|
FWAIT
|
||||||
FLDCW Default8087CW
|
FLDCW Default8087CW
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
AppPath := PPKolibriChar(32)^;
|
||||||
|
CmdLine := PPKolibriChar(28)^;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user