2007-08-29 11:16:31 +02:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
procedure OpenStdout(var f: TextRec); forward;
|
|
|
|
|
procedure WriteStdout(var f: TextRec); forward;
|
2007-10-27 18:38:51 +02:00
|
|
|
|
procedure FlushStdout(var f: TextRec); forward;
|
2007-08-29 11:16:31 +02:00
|
|
|
|
procedure CloseStdout(var f: TextRec); forward;
|
|
|
|
|
|
|
|
|
|
procedure OpenStdin(var f: TextRec); forward;
|
|
|
|
|
procedure ReadStdin(var f: TextRec); forward;
|
|
|
|
|
procedure CloseStdin(var f: TextRec); forward;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure AssignStdout(var f: Text);
|
|
|
|
|
begin
|
|
|
|
|
Assign(f, '');
|
|
|
|
|
TextRec(f).OpenFunc := @OpenStdout;
|
|
|
|
|
Rewrite(f);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure OpenStdout(var f: TextRec);
|
|
|
|
|
begin
|
|
|
|
|
TextRec(f).InOutFunc := @WriteStdout;
|
2007-10-27 18:38:51 +02:00
|
|
|
|
TextRec(f).FlushFunc := @FlushStdout;
|
2007-08-29 11:16:31 +02:00
|
|
|
|
TextRec(f).CloseFunc := @CloseStdout;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure WriteStdout(var f: TextRec);
|
|
|
|
|
var
|
|
|
|
|
msg: String;
|
|
|
|
|
begin
|
|
|
|
|
msg := StrPas(PChar(f.bufptr));
|
|
|
|
|
SetLength(msg, f.bufpos);
|
|
|
|
|
f.bufpos := 0;
|
|
|
|
|
Konsole.Write(msg);
|
|
|
|
|
end;
|
|
|
|
|
|
2007-10-27 18:38:51 +02:00
|
|
|
|
procedure FlushStdout(var f: TextRec);
|
|
|
|
|
begin
|
|
|
|
|
WriteStdout(f);
|
|
|
|
|
Konsole.Flush;
|
|
|
|
|
end;
|
|
|
|
|
|
2007-08-29 11:16:31 +02:00
|
|
|
|
procedure CloseStdout(var f: TextRec);
|
|
|
|
|
begin
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure AssignStdin(var f: Text);
|
|
|
|
|
begin
|
|
|
|
|
Assign(f, '');
|
|
|
|
|
TextRec(f).OpenFunc := @OpenStdin;
|
|
|
|
|
Reset(f);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure OpenStdin(var f: TextRec);
|
|
|
|
|
begin
|
|
|
|
|
TextRec(f).InOutFunc := @ReadStdin;
|
|
|
|
|
TextRec(f).FlushFunc := nil;
|
|
|
|
|
TextRec(f).CloseFunc := @CloseStdin;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure ReadStdin(var f: TextRec);
|
|
|
|
|
var
|
|
|
|
|
max, curpos: Longint;
|
|
|
|
|
c: Longint;
|
|
|
|
|
begin
|
|
|
|
|
max := f.bufsize - Length(LineEnding);
|
|
|
|
|
curpos := 0;
|
|
|
|
|
repeat
|
|
|
|
|
c := 13{l4_getc()};
|
|
|
|
|
case c of
|
|
|
|
|
13:
|
|
|
|
|
begin
|
|
|
|
|
{f.bufptr^[curpos] := LineEnding;}
|
|
|
|
|
Inc(curpos);
|
|
|
|
|
f.bufpos := 0;
|
|
|
|
|
f.bufend := curpos;
|
|
|
|
|
{l4_putc(Longint(LineEnding));}
|
|
|
|
|
break;
|
|
|
|
|
end;
|
|
|
|
|
32..126: if curpos < max then
|
|
|
|
|
begin
|
|
|
|
|
f.bufptr^[curpos] := Char(c);
|
|
|
|
|
Inc(curpos);
|
|
|
|
|
{l4_putc(c);}
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
until False;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure CloseStdin(var f: TextRec);
|
|
|
|
|
begin
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ TKonsole }
|
|
|
|
|
|
|
|
|
|
procedure KonsoleThreadMain(Console: PKonsole);
|
|
|
|
|
{<EFBFBD><EFBFBD><EFBFBD><EFBFBD>稩 横<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>᮫<EFBFBD>}
|
|
|
|
|
var
|
|
|
|
|
ThreadInfo: TKosThreadInfo;
|
|
|
|
|
Message: ShortString;
|
|
|
|
|
Event: DWord;
|
|
|
|
|
begin
|
|
|
|
|
kos_maskevents(ME_PAINT or ME_KEYBOARD or ME_IPC);
|
|
|
|
|
kos_threadinfo(@ThreadInfo);
|
|
|
|
|
Console^.FThreadSlot := kos_getthreadslot(ThreadInfo.ThreadID);
|
|
|
|
|
|
|
|
|
|
kos_initipc(Console^.FIPCBuffer, Console^.FIPCBufferSize);
|
|
|
|
|
|
|
|
|
|
{<EFBFBD>ࠧ<EFBFBD> <EFBFBD>⮡ࠧ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD>⨢<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
|
|
|
|
|
Console^.Paint();
|
|
|
|
|
{$ifndef EMULATOR}
|
|
|
|
|
kos_setactivewindow(Console^.FThreadSlot);
|
|
|
|
|
{$endif}
|
|
|
|
|
|
|
|
|
|
{<EFBFBD><EFBFBD>⮢ <EFBFBD> <EFBFBD><EFBFBD>ࠡ<EFBFBD>⪥ ᮡ<EFBFBD>⨩}
|
|
|
|
|
Console^.FOpened := True;
|
|
|
|
|
while not Console^.FTerminate do
|
|
|
|
|
begin
|
|
|
|
|
Event := kos_getevent();
|
2007-10-27 18:38:51 +02:00
|
|
|
|
Console^.FOnAir := True;
|
2007-09-04 15:23:24 +02:00
|
|
|
|
if not Console^.FTerminate then
|
2007-08-29 11:16:31 +02:00
|
|
|
|
case Event of
|
|
|
|
|
SE_PAINT: Console^.Paint();
|
|
|
|
|
SE_KEYBOARD: Console^.ProcessKeyboard(kos_getkey());
|
|
|
|
|
SE_IPC: while Console^.ReceiveMessage(Message) do Console^.ProcessMessage(Message);
|
|
|
|
|
end;
|
2007-10-27 18:38:51 +02:00
|
|
|
|
Console^.FOnAir := False;
|
2007-08-29 11:16:31 +02:00
|
|
|
|
end;
|
|
|
|
|
Console^.FOpened := False;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor TKonsole.Init(ACaption: String);
|
|
|
|
|
const
|
|
|
|
|
IPC_SIZE = 4096;
|
|
|
|
|
var
|
|
|
|
|
ThreadInfo: TKosThreadInfo;
|
|
|
|
|
begin
|
|
|
|
|
if ACaption <> '' then
|
|
|
|
|
FCaption := ACaption else
|
|
|
|
|
begin
|
|
|
|
|
kos_threadinfo(@ThreadInfo);
|
|
|
|
|
FCaption := StrPas(ThreadInfo.AppName);
|
|
|
|
|
end;
|
|
|
|
|
SetLength(FLines, 1);
|
2007-10-27 18:38:51 +02:00
|
|
|
|
FLines[0] := '';
|
2007-08-29 11:16:31 +02:00
|
|
|
|
FCursor.X := 1;
|
|
|
|
|
FCursor.Y := 0;
|
|
|
|
|
FMaxLines := 150;
|
|
|
|
|
FTerminate := False;
|
|
|
|
|
FOpened := False;
|
2007-10-27 18:38:51 +02:00
|
|
|
|
FOnAir := False;
|
2007-08-29 11:16:31 +02:00
|
|
|
|
FIPCBufferSize := SizeOf(TKosIPC) + IPC_SIZE;
|
|
|
|
|
FIPCBuffer := GetMem(FIPCBufferSize);
|
|
|
|
|
FIPCBuffer^.Lock := False;
|
|
|
|
|
FIPCBuffer^.Size := 0;
|
|
|
|
|
FThreadSlot := -1;
|
|
|
|
|
FThreadID := BeginThread(TThreadFunc(@KonsoleThreadMain), @Self);
|
|
|
|
|
if FThreadID <> 0 then
|
2007-09-04 15:23:24 +02:00
|
|
|
|
{XXX: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
|
|
|
|
|
while not FOpened do ThreadSwitch;
|
2007-08-29 11:16:31 +02:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
destructor TKonsole.Done();
|
|
|
|
|
begin
|
|
|
|
|
FTerminate := True;
|
2007-09-04 15:23:24 +02:00
|
|
|
|
if FOpened then begin Self.Write(#0); kos_delay(01); end;
|
|
|
|
|
if FOpened then begin Self.Write(#0); kos_delay(10); end;
|
|
|
|
|
if FOpened then begin Self.Write(#0); kos_delay(20); end;
|
2007-08-29 11:16:31 +02:00
|
|
|
|
if FOpened then
|
|
|
|
|
begin
|
|
|
|
|
FOpened := False;
|
2007-10-27 18:38:51 +02:00
|
|
|
|
FOnAir := False;
|
2007-08-29 11:16:31 +02:00
|
|
|
|
KillThread(FThreadID);
|
|
|
|
|
end;
|
2007-10-27 18:38:51 +02:00
|
|
|
|
{FreeMem(FIPCBuffer);
|
|
|
|
|
SetLength(FLines, 0);}
|
2007-08-29 11:16:31 +02:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TKonsole.ReceiveMessage(var Message: ShortString): Boolean;
|
|
|
|
|
{<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ࢮ<EFBFBD> ᮮ<EFBFBD>饭<EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
|
|
|
|
|
var
|
|
|
|
|
PMsg: PKosMessage;
|
|
|
|
|
Size: Longword;
|
|
|
|
|
begin
|
2007-10-27 18:38:51 +02:00
|
|
|
|
FIPCBuffer^.Lock := True;
|
|
|
|
|
|
2007-08-29 11:16:31 +02:00
|
|
|
|
if FIPCBuffer^.Size > 0 then
|
|
|
|
|
begin
|
|
|
|
|
PMsg := Pointer(Longword(FIPCBuffer) + SizeOf(TKosIPC));
|
|
|
|
|
{TODO: <EFBFBD><EFBFBD>ઠ PMsg^.SenderID}
|
|
|
|
|
{Size := PMsg^.Size;
|
|
|
|
|
Dec(FIPCBuffer^.Size, Size + SizeOf(TKosMessage));
|
|
|
|
|
if Size > 255 then Size := 255;
|
|
|
|
|
SetLength(Message, Size);
|
|
|
|
|
Move(Pointer(Longword(PMsg) + SizeOf(TKosMessage))^, Message[1], Size);
|
|
|
|
|
if FIPCBuffer^.Size > 0 then
|
|
|
|
|
Move(Pointer(Longword(PMsg) + SizeOf(TKosMessage) + PMsg^.Size)^, PMsg^, FIPCBuffer^.Size);}
|
|
|
|
|
|
|
|
|
|
{XXX}
|
|
|
|
|
Size := FIPCBuffer^.Size;
|
|
|
|
|
Dec(FIPCBuffer^.Size, Size);
|
|
|
|
|
if Size > 255 then Size := 255;
|
|
|
|
|
SetLength(Message, Size);
|
|
|
|
|
Move(PMsg^, Message[1], Size);
|
|
|
|
|
|
|
|
|
|
Result := True;
|
|
|
|
|
end else
|
|
|
|
|
begin
|
|
|
|
|
Message := '';
|
|
|
|
|
Result := False;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
{FIXME: <EFBFBD> FIPCBuffer^.Size = 0, <EFBFBD><EFBFBD> FIPCBuffer^.Lock <EFBFBD><EFBFBD><EFBFBD> ࠢ<EFBFBD><EFBFBD> > 0}
|
|
|
|
|
FIPCBuffer^.Lock := False;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TKonsole.ProcessMessage(Message: ShortString);
|
2007-10-27 18:38:51 +02:00
|
|
|
|
{ <EFBFBD>뢥<EFBFBD><EFBFBD><EFBFBD> ᮮ<EFBFBD>饭<EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>᮫<EFBFBD> }
|
2007-08-29 11:16:31 +02:00
|
|
|
|
var
|
2007-10-27 18:38:51 +02:00
|
|
|
|
OnlyBottomLine: Boolean = True;
|
2007-08-29 11:16:31 +02:00
|
|
|
|
|
2007-10-27 18:38:51 +02:00
|
|
|
|
procedure PutChar(C: Char);
|
|
|
|
|
var
|
|
|
|
|
LinesCount: Longint;
|
|
|
|
|
PLine: PShortString;
|
|
|
|
|
I: Longint;
|
|
|
|
|
begin
|
|
|
|
|
{ <EFBFBD><EFBFBD>ॢ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>⪨ <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> }
|
|
|
|
|
if C = #8 then
|
|
|
|
|
begin
|
|
|
|
|
if FCursor.X > 1 then
|
|
|
|
|
Dec(FCursor.X);
|
|
|
|
|
end else
|
|
|
|
|
|
|
|
|
|
{ <EFBFBD><EFBFBD>ॢ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>⪨ <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ப<EFBFBD> }
|
|
|
|
|
if C = #10 then
|
|
|
|
|
begin
|
|
|
|
|
OnlyBottomLine := False;
|
|
|
|
|
Inc(FCursor.Y);
|
|
|
|
|
LinesCount := Length(FLines);
|
|
|
|
|
while FCursor.Y >= FMaxLines do Dec(FCursor.Y, FMaxLines);
|
|
|
|
|
if FCursor.Y < LinesCount then FLines[FCursor.Y] := '';
|
|
|
|
|
while FCursor.Y >= LinesCount do
|
|
|
|
|
begin
|
|
|
|
|
SetLength(FLines, LinesCount + 1);
|
|
|
|
|
FLines[LinesCount] := '';
|
|
|
|
|
Inc(LinesCount);
|
|
|
|
|
end;
|
|
|
|
|
end else
|
|
|
|
|
|
|
|
|
|
{ <EFBFBD><EFBFBD>ॢ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>⪨ <EFBFBD> <EFBFBD><EFBFBD>砫<EFBFBD> <EFBFBD><EFBFBD>ப<EFBFBD> }
|
|
|
|
|
if C = #13 then
|
|
|
|
|
FCursor.X := 1 else
|
|
|
|
|
|
|
|
|
|
{ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>饭<EFBFBD><EFBFBD> ᨬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD>ப<EFBFBD> }
|
2007-08-29 11:16:31 +02:00
|
|
|
|
begin
|
2007-10-27 18:38:51 +02:00
|
|
|
|
if FCursor.X > 200 then
|
2007-08-29 11:16:31 +02:00
|
|
|
|
begin
|
2007-10-27 18:38:51 +02:00
|
|
|
|
PutChar(#13);
|
|
|
|
|
PutChar(#10);
|
2007-08-29 11:16:31 +02:00
|
|
|
|
end;
|
2007-10-27 18:38:51 +02:00
|
|
|
|
|
|
|
|
|
{ FIXME: <EFBFBD> <EFBFBD> PascalMain ⮫쪮 <EFBFBD><EFBFBD><EFBFBD><EFBFBD> Write/Ln, <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᮭ.
|
|
|
|
|
<EFBFBD><EFBFBD>. FPC_DO_EXIT, InternalExit }
|
|
|
|
|
PLine := @FLines[FCursor.Y];
|
|
|
|
|
I := Length(PLine^);
|
|
|
|
|
if FCursor.X > I then
|
2007-08-29 11:16:31 +02:00
|
|
|
|
begin
|
2007-10-27 18:38:51 +02:00
|
|
|
|
SetLength(PLine^, FCursor.X);
|
|
|
|
|
Inc(I);
|
|
|
|
|
while I < FCursor.X do
|
2007-08-29 11:16:31 +02:00
|
|
|
|
begin
|
2007-10-27 18:38:51 +02:00
|
|
|
|
PLine^[I] := ' ';
|
|
|
|
|
Inc(I);
|
2007-08-29 11:16:31 +02:00
|
|
|
|
end;
|
|
|
|
|
end;
|
2007-10-27 18:38:51 +02:00
|
|
|
|
FLines[FCursor.Y][FCursor.X] := C;
|
|
|
|
|
|
|
|
|
|
Inc(FCursor.X);
|
2007-08-29 11:16:31 +02:00
|
|
|
|
end;
|
2007-10-27 18:38:51 +02:00
|
|
|
|
end;
|
2007-08-29 11:16:31 +02:00
|
|
|
|
|
2007-10-27 18:38:51 +02:00
|
|
|
|
var
|
|
|
|
|
I: Longint;
|
|
|
|
|
begin
|
|
|
|
|
for I := 1 to Length(Message) do
|
|
|
|
|
PutChar(Message[I]);
|
|
|
|
|
Paint(OnlyBottomLine);
|
2007-08-29 11:16:31 +02:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TKonsole.ProcessKeyboard(Key: Word);
|
|
|
|
|
begin
|
|
|
|
|
FKeyPressed := Key;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TKonsole.GetRect(): TKosRect;
|
|
|
|
|
var
|
|
|
|
|
ThreadInfo: TKosThreadInfo;
|
|
|
|
|
begin
|
|
|
|
|
kos_threadinfo(@ThreadInfo, FThreadSlot);
|
|
|
|
|
Result := ThreadInfo.WindowRect;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TKonsole.GetKeyPressed(): Word;
|
|
|
|
|
begin
|
|
|
|
|
Result := FKeyPressed;
|
|
|
|
|
FKeyPressed := 0;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TKonsole.Paint(BottomRow: Boolean);
|
|
|
|
|
var
|
|
|
|
|
Buffer: array[Byte] of Char;
|
|
|
|
|
Rect: TKosRect;
|
|
|
|
|
J: Longint;
|
|
|
|
|
Width, Height, Row: Longint;
|
|
|
|
|
CaptionHeight, BorderWidth, FontWidth, FontHeight: Longint;
|
|
|
|
|
begin
|
|
|
|
|
CaptionHeight := 16;
|
|
|
|
|
BorderWidth := 5;
|
|
|
|
|
FontWidth := 6;
|
|
|
|
|
FontHeight := 9;
|
|
|
|
|
|
|
|
|
|
kos_begindraw();
|
|
|
|
|
|
|
|
|
|
if not BottomRow then
|
|
|
|
|
begin
|
|
|
|
|
{<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᮢ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
|
|
|
|
|
kos_definewindow(60, 60, 400, 400, $63000000);
|
|
|
|
|
{<EFBFBD>뢮<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
|
|
|
|
|
Move(FCaption[1], Buffer, Length(FCaption));
|
|
|
|
|
Buffer[Length(FCaption)] := #0;
|
|
|
|
|
kos_setcaption(Buffer);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
{<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⮢<EFBFBD><EFBFBD> <EFBFBD> <EFBFBD>뢮<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ப}
|
|
|
|
|
Rect := GetRect();
|
|
|
|
|
Dec(Rect.Width, BorderWidth * 2);
|
|
|
|
|
Dec(Rect.Height, CaptionHeight + BorderWidth * 2);
|
|
|
|
|
Width := Rect.Width div FontWidth;
|
|
|
|
|
Height := Rect.Height - FontHeight;
|
|
|
|
|
Row := FCursor.Y;
|
|
|
|
|
|
|
|
|
|
while Height > 0 do
|
|
|
|
|
begin
|
|
|
|
|
{<EFBFBD>뢮<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ப<EFBFBD>}
|
|
|
|
|
J := Length(FLines[Row]);
|
|
|
|
|
if J > Width then J := Width;
|
|
|
|
|
kos_drawtext(0, Height, Copy(FLines[Row], 1, J), $00DD00, $FF000000);
|
|
|
|
|
{<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>⠢襣<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>࠭<EFBFBD>⢠ <EFBFBD> <EFBFBD><EFBFBD>ப<EFBFBD>}
|
|
|
|
|
J := J * FontWidth;
|
|
|
|
|
kos_drawrect(J, Height, Rect.Width - J + 1, FontHeight, $000000);
|
|
|
|
|
{<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⮢<EFBFBD><EFBFBD> <EFBFBD> <EFBFBD>뢮<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>饩 <EFBFBD><EFBFBD>ப<EFBFBD>}
|
|
|
|
|
Dec(Height, FontHeight);
|
|
|
|
|
Dec(Row);
|
|
|
|
|
if BottomRow or ((Row < 0) and (Length(FLines) < FMaxLines)) then Break;
|
|
|
|
|
while Row < 0 do Inc(Row, FMaxLines);
|
|
|
|
|
end;
|
|
|
|
|
if FCursor.X <= Width then
|
|
|
|
|
{<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᮢ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
|
|
|
|
|
kos_drawrect((FCursor.X - 1) * FontWidth, Rect.Height - 2, FontWidth, 2, $FFFFFF);
|
|
|
|
|
if not BottomRow then
|
|
|
|
|
{<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>⠢襩<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
|
|
|
|
|
kos_drawrect(0, 0, Rect.Width + 1, Height + FontHeight, $000000);
|
|
|
|
|
|
|
|
|
|
kos_enddraw();
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TKonsole.Write(Message: ShortString);
|
|
|
|
|
var
|
|
|
|
|
I: Integer;
|
|
|
|
|
begin
|
|
|
|
|
{XXX: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ன ᮮ<EFBFBD>饭<EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD>㤥<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ࠢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>}
|
|
|
|
|
if FOpened then
|
|
|
|
|
begin
|
2007-09-04 15:23:24 +02:00
|
|
|
|
I := 100;
|
2007-08-29 11:16:31 +02:00
|
|
|
|
while (kos_sendmsg(FThreadID, @Message[1], Length(Message)) = 2) and (I > 0) do
|
|
|
|
|
begin
|
|
|
|
|
Dec(I);
|
|
|
|
|
ThreadSwitch;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
2007-10-27 18:38:51 +02:00
|
|
|
|
|
|
|
|
|
procedure TKonsole.Flush();
|
|
|
|
|
begin
|
|
|
|
|
while FOnAir do ThreadSwitch;
|
|
|
|
|
end;
|