mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 10:09:20 +02:00
* avoid crt use (merged)
This commit is contained in:
parent
18ed3a96a1
commit
bdb90bfda6
@ -18,9 +18,38 @@ unit WANSI;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses Objects,Drivers,Crt,Dos,Views,App;
|
uses Objects,Drivers,
|
||||||
|
{$ifdef WITH_CRT}
|
||||||
|
Crt,
|
||||||
|
{$endif WITH_CRT}
|
||||||
|
Dos,Views,App;
|
||||||
|
|
||||||
const
|
const
|
||||||
|
{$ifndef WITH_CRT}
|
||||||
|
{ Foreground and background color constants }
|
||||||
|
Black = 0;
|
||||||
|
Blue = 1;
|
||||||
|
Green = 2;
|
||||||
|
Cyan = 3;
|
||||||
|
Red = 4;
|
||||||
|
Magenta = 5;
|
||||||
|
Brown = 6;
|
||||||
|
LightGray = 7;
|
||||||
|
|
||||||
|
{ Foreground color constants }
|
||||||
|
DarkGray = 8;
|
||||||
|
LightBlue = 9;
|
||||||
|
LightGreen = 10;
|
||||||
|
LightCyan = 11;
|
||||||
|
LightRed = 12;
|
||||||
|
LightMagenta = 13;
|
||||||
|
Yellow = 14;
|
||||||
|
White = 15;
|
||||||
|
|
||||||
|
{ Add-in for blinking }
|
||||||
|
Blink = 128;
|
||||||
|
{$endif not WITH_CRT}
|
||||||
|
|
||||||
ANSIMaxParamLen = 30; { max ANSI escape sequence length }
|
ANSIMaxParamLen = 30; { max ANSI escape sequence length }
|
||||||
ANSICurPosStackSize = 20; { max number of cursor positions stored at the same time }
|
ANSICurPosStackSize = 20; { max number of cursor positions stored at the same time }
|
||||||
|
|
||||||
@ -107,6 +136,7 @@ type
|
|||||||
procedure SetAttr(Color: integer); virtual;
|
procedure SetAttr(Color: integer); virtual;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$ifdef WITH_CRT}
|
||||||
PCrtConsole = ^TCrtConsole;
|
PCrtConsole = ^TCrtConsole;
|
||||||
TCrtConsole = object(TANSIConsole)
|
TCrtConsole = object(TANSIConsole)
|
||||||
constructor Init(AReplyHook, AKeyHook, AWriteHook: PHookProc);
|
constructor Init(AReplyHook, AKeyHook, AWriteHook: PHookProc);
|
||||||
@ -121,6 +151,7 @@ type
|
|||||||
procedure TextBackground(Color: byte); virtual;
|
procedure TextBackground(Color: byte); virtual;
|
||||||
procedure TextColor(Color: byte); virtual;
|
procedure TextColor(Color: byte); virtual;
|
||||||
end;
|
end;
|
||||||
|
{$endif WITH_CRT}
|
||||||
|
|
||||||
PANSIView = ^TANSIView;
|
PANSIView = ^TANSIView;
|
||||||
|
|
||||||
@ -385,6 +416,7 @@ begin
|
|||||||
inherited Done;
|
inherited Done;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$ifdef WITH_CRT}
|
||||||
constructor TCrtConsole.Init(AReplyHook, AKeyHook, AWriteHook: PHookProc);
|
constructor TCrtConsole.Init(AReplyHook, AKeyHook, AWriteHook: PHookProc);
|
||||||
begin
|
begin
|
||||||
inherited Init(AReplyHook, AKeyHook, AWriteHook);
|
inherited Init(AReplyHook, AKeyHook, AWriteHook);
|
||||||
@ -451,6 +483,7 @@ begin
|
|||||||
inherited TextColor(Color);
|
inherited TextColor(Color);
|
||||||
Crt.TextAttr:=TextAttr;
|
Crt.TextAttr:=TextAttr;
|
||||||
end;
|
end;
|
||||||
|
{$endif WITH_CRT}
|
||||||
|
|
||||||
constructor TANSIConsole.Init(AReplyHook, AKeyHook, AWriteHook: PHookProc);
|
constructor TANSIConsole.Init(AReplyHook, AKeyHook, AWriteHook: PHookProc);
|
||||||
begin
|
begin
|
||||||
@ -464,7 +497,7 @@ var SkipThis : boolean;
|
|||||||
ANSIDone : boolean;
|
ANSIDone : boolean;
|
||||||
X,Y,Z : integer;
|
X,Y,Z : integer;
|
||||||
begin
|
begin
|
||||||
SkipThis:=false;
|
SkipThis:=false;
|
||||||
if C=Esc then begin ANSILevel:=1; SkipThis:=true; end else
|
if C=Esc then begin ANSILevel:=1; SkipThis:=true; end else
|
||||||
if (ANSILevel=1) then
|
if (ANSILevel=1) then
|
||||||
begin
|
begin
|
||||||
@ -1006,6 +1039,6 @@ end;
|
|||||||
|
|
||||||
END.
|
END.
|
||||||
{
|
{
|
||||||
$Log $
|
$Log $
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user