A33 work
This commit is contained in:
parent
0eb4d5760f
commit
de20817ca8
|
@ -125,7 +125,7 @@ Procedure TNLOG (Str: String);
|
|||
Var
|
||||
T : Text;
|
||||
Begin
|
||||
Assign (T, 'tnlog.txt');
|
||||
Assign (T, 'sockdebug.txt');
|
||||
{$I-} Append(T); {$I+}
|
||||
|
||||
If IoResult <> 0 Then ReWrite(T);
|
||||
|
@ -579,7 +579,15 @@ Begin
|
|||
SIN.sin_addr.s_addr := 0;
|
||||
SIN.sin_port := htons(Port);
|
||||
|
||||
fpBind(FSocketHandle, @SIN, SizeOf(SIN));
|
||||
{$IFDEF TNDEBUG}
|
||||
TNLOG('WaitInit Bind');
|
||||
If fpBind(FSocketHandle, @SIN, SizeOf(SIN)) <> 0 Then
|
||||
TNLOG('WaitInit Bind Failed')
|
||||
Else
|
||||
TNLOG('Bind OK');
|
||||
{$ELSE}
|
||||
fpBind(FSocketHandle, @SIN, SizeOf(SIN));
|
||||
{$ENDIF}
|
||||
|
||||
SetBlocking(True);
|
||||
End;
|
||||
|
|
|
@ -14,7 +14,7 @@ Const
|
|||
|
||||
Type
|
||||
TSTDIO = Class(TIOBase)
|
||||
Constructor Create;
|
||||
Constructor Create; Override;
|
||||
Destructor Destroy; Override;
|
||||
Function DataWaiting : Boolean; Override;
|
||||
Function WriteBuf (Var Buf; Len: LongInt) : LongInt; Override;
|
||||
|
|
|
@ -64,10 +64,12 @@
|
|||
{$IMPLICITEXCEPTIONS OFF}
|
||||
{$OBJECTCHECKS OFF}
|
||||
|
||||
{$IFDEF CPUX86_64
|
||||
{$FPUTYPE SSE64}
|
||||
{$ELSE}
|
||||
{$FPUTYPE SSE}
|
||||
{$IFDEF CPU386}
|
||||
{$IFDEF CPUX86_64
|
||||
{$FPUTYPE SSE64}
|
||||
{$ELSE}
|
||||
{$FPUTYPE SSE}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF DEBUG}
|
||||
|
|
|
@ -131,6 +131,7 @@ End;
|
|||
Const
|
||||
AnsiTable : String[8] = '04261537';
|
||||
|
||||
(*
|
||||
Function TOutputLinux.AttrToAnsi (Attr: Byte) : String;
|
||||
Var
|
||||
Str : String[16];
|
||||
|
@ -187,6 +188,66 @@ Begin
|
|||
FTextAttr := FG + BG * 16;
|
||||
AttrToAnsi := #27 + '[' + Str + 'm';
|
||||
End;
|
||||
*)
|
||||
|
||||
Function TOutputLinux.AttrToAnsi (Attr: Byte) : String;
|
||||
Var
|
||||
OldFG : LongInt;
|
||||
OldBG : LongInt;
|
||||
FG : LongInt;
|
||||
BG : LongInt;
|
||||
|
||||
Procedure AddSep (Ch: Char);
|
||||
Begin
|
||||
If Length(Result) > 0 Then
|
||||
Result := Result + ';';
|
||||
|
||||
Result := Result + Ch;
|
||||
End;
|
||||
|
||||
Begin
|
||||
Result := '';
|
||||
|
||||
If Attr = FTextAttr Then Exit;
|
||||
|
||||
FG := Attr and $F;
|
||||
BG := Attr shr 4;
|
||||
OldFG := FTextAttr and $F;
|
||||
OldBG := FTextAttr shr 4;
|
||||
|
||||
If (OldFG <> 7) or (FG = 7) or ((OldFG > 7) and (FG < 8)) or ((OldBG > 7) and (BG < 8)) Then Begin
|
||||
Result := '0';
|
||||
OldFG := 7;
|
||||
OldBG := 0;
|
||||
End;
|
||||
|
||||
If (FG > 7) and (OldFG < 8) Then Begin
|
||||
AddSep('1');
|
||||
|
||||
OldFG := OldFG or 8;
|
||||
End;
|
||||
|
||||
If (BG and 8) <> (OldBG and 8) Then Begin
|
||||
AddSep('5');
|
||||
|
||||
OldBG := OldBG or 8;
|
||||
End;
|
||||
|
||||
If (FG <> OldFG) Then Begin
|
||||
AddSep('3');
|
||||
|
||||
Result := Result + AnsiTable[(FG and 7) + 1];
|
||||
End;
|
||||
|
||||
If (BG <> OldBG) Then Begin
|
||||
AddSep('4');
|
||||
|
||||
Result := Result + AnsiTable[(BG and 7) + 1];
|
||||
End;
|
||||
|
||||
FTextAttr := FG + BG * 16;
|
||||
Result := #27 + '[' + Result + 'm';
|
||||
End;
|
||||
|
||||
Procedure TOutputLinux.BufFlush;
|
||||
Begin
|
||||
|
@ -213,7 +274,7 @@ Begin
|
|||
|
||||
BufAddStr(AttrToAnsi(Attr));
|
||||
|
||||
FTextAttr := Attr;
|
||||
// FTextAttr := Attr;
|
||||
End;
|
||||
|
||||
Procedure TOutputLinux.CursorXYRaw (X, Y: Byte);
|
||||
|
@ -362,10 +423,14 @@ Begin
|
|||
|
||||
If FCursorY < FWinBot Then
|
||||
Inc (FCursorY)
|
||||
Else
|
||||
Else Begin
|
||||
ScrollWindow;
|
||||
BufFlush;
|
||||
End;
|
||||
// Else
|
||||
// ScrollWindow;
|
||||
|
||||
BufFlush;
|
||||
// BufFlush;
|
||||
End;
|
||||
End;
|
||||
End;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{$I M_OPS.PAS}
|
||||
|
||||
Unit m_Output_Windows;
|
||||
|
||||
{$I M_OPS.PAS}
|
||||
|
||||
Interface
|
||||
|
||||
Uses
|
||||
|
@ -107,6 +107,7 @@ Begin
|
|||
50 : ScreenSize := 50;
|
||||
Else
|
||||
SetScreenSize(25);
|
||||
|
||||
ScreenSize := 25;
|
||||
End;
|
||||
|
||||
|
@ -167,6 +168,22 @@ Begin
|
|||
SetConsoleCursorPosition(ConOut, Cursor);
|
||||
End;
|
||||
|
||||
Procedure TOutputWindows.ClearEOL;
|
||||
Var
|
||||
Count : Byte;
|
||||
Res : LongInt;
|
||||
Begin
|
||||
Count := Window.Right - Cursor.X + 1;
|
||||
|
||||
FillDWord (Buffer[Cursor.Y + 1][Cursor.X + 1], Count, (Word(TextAttr) SHL 16) OR Word($0020));
|
||||
|
||||
If Active Then Begin
|
||||
FillConsoleOutputCharacter (ConOut, ' ', Count, Cursor, @Res);
|
||||
FillConsoleOutputAttribute (ConOut, TextAttr, Count, Cursor, @Res);
|
||||
End;
|
||||
End;
|
||||
|
||||
(*
|
||||
Procedure TOutputWindows.ClearEOL;
|
||||
Var
|
||||
Buf : Array[1..80] of TCharInfo;
|
||||
|
@ -191,7 +208,7 @@ Begin
|
|||
FillConsoleOutputAttribute (ConOut, TextAttr, Count, Cursor, @Res);
|
||||
End;
|
||||
End;
|
||||
|
||||
*)
|
||||
Procedure TOutputWindows.ClearScreenNoUpdate;
|
||||
Var
|
||||
Res : ULong;
|
||||
|
@ -261,7 +278,6 @@ Begin
|
|||
Inc (Count);
|
||||
End;
|
||||
|
||||
// add to screen buffer
|
||||
Move (Buf[1], Buffer[Y][X], (Count - 1) * SizeOf(TCharInfo));
|
||||
|
||||
If Active Then Begin
|
||||
|
@ -342,6 +358,7 @@ Begin
|
|||
|
||||
If (Code = '00') or ((CodeNum > 0) and (CodeNum < 24) and (Code[1] <> '$') and (Code[1] <> '&')) Then Begin
|
||||
Inc (Count, 2);
|
||||
|
||||
If CodeNum in [00..15] Then
|
||||
Attr := CodeNum + ((Attr SHR 4) AND 7) * 16
|
||||
Else
|
||||
|
@ -388,6 +405,76 @@ Begin
|
|||
CursorY := Cursor.Y + 1;
|
||||
End;
|
||||
|
||||
Procedure TOutputWindows.WriteChar (Ch: Char);
|
||||
Var
|
||||
BufferSize,
|
||||
BufferCoord : TCoord;
|
||||
WriteRegion : TSmallRect;
|
||||
OneCell : TCharInfo;
|
||||
// Res : LongInt;
|
||||
Begin
|
||||
Case Ch of
|
||||
#08 : If Cursor.X > Window.Left Then Begin
|
||||
Dec(Cursor.X);
|
||||
|
||||
If Active Then SetConsoleCursorPosition(ConOut, Cursor);
|
||||
End;
|
||||
#10 : Begin
|
||||
If Cursor.Y = Window.Bottom Then
|
||||
ScrollWindow
|
||||
Else Begin
|
||||
Inc (Cursor.Y);
|
||||
|
||||
Cursor.X := Window.Left;
|
||||
End;
|
||||
|
||||
If Active Then SetConsoleCursorPosition(ConOut, Cursor);
|
||||
End;
|
||||
#13 : Cursor.X := Window.Left;
|
||||
Else
|
||||
If Active Then Begin
|
||||
OneCell.UnicodeChar := Ch;
|
||||
OneCell.Attributes := TextAttr;
|
||||
|
||||
BufferSize.X := 1;
|
||||
BufferSize.Y := 1;
|
||||
BufferCoord.X := 0;
|
||||
BufferCoord.Y := 0;
|
||||
|
||||
WriteRegion.Left := Cursor.X;
|
||||
WriteRegion.Top := Cursor.Y;
|
||||
WriteRegion.Right := Cursor.X;
|
||||
WriteRegion.Bottom := Cursor.Y;
|
||||
// FillConsoleOutputCharacter (ConOut, Ch, 1, Cursor, @Res);
|
||||
// FillConsoleOutputAttribute (ConOut, TextAttr, 1, Cursor, @Res);
|
||||
|
||||
WriteConsoleOutput (ConOut, @OneCell, BufferSize, BufferCoord, WriteRegion);
|
||||
End;
|
||||
|
||||
Buffer[Cursor.Y + 1][Cursor.X + 1].UnicodeChar := Ch;
|
||||
Buffer[Cursor.Y + 1][Cursor.X + 1].Attributes := TextAttr;
|
||||
|
||||
If Cursor.X < Window.Right Then
|
||||
Inc (Cursor.X)
|
||||
Else Begin
|
||||
If (Cursor.X = Window.Right) And (Cursor.Y = Window.Bottom - 1) Then Begin
|
||||
Inc (Cursor.X);
|
||||
Exit;
|
||||
End;
|
||||
|
||||
Cursor.X := Window.Left;
|
||||
|
||||
If Cursor.Y = Window.Bottom Then
|
||||
ScrollWindow
|
||||
Else
|
||||
Inc (Cursor.Y);
|
||||
End;
|
||||
|
||||
If Active Then SetConsoleCursorPosition(ConOut, Cursor);
|
||||
End;
|
||||
End;
|
||||
|
||||
(*
|
||||
Procedure TOutputWindows.WriteChar (Ch: Char);
|
||||
Var
|
||||
BufferSize,
|
||||
|
@ -451,6 +538,7 @@ Begin
|
|||
If Active Then SetConsoleCursorPosition(ConOut, Cursor);
|
||||
End;
|
||||
End;
|
||||
*)
|
||||
|
||||
Procedure TOutputWindows.WriteLine (Str: String);
|
||||
Var
|
||||
|
@ -470,32 +558,20 @@ End;
|
|||
|
||||
Procedure TOutputWindows.ScrollWindow;
|
||||
Var
|
||||
ClipRect,
|
||||
ScrollRect : TSmallRect;
|
||||
DestCoord : TCoord;
|
||||
Fill : TCharInfo;
|
||||
Begin
|
||||
Fill.UnicodeChar := ' ';
|
||||
// Fill.Attributes := TextAttr;
|
||||
Fill.Attributes := 7;
|
||||
|
||||
ScrollRect.Left := Window.Left;
|
||||
ScrollRect.Top := Window.Top;
|
||||
ScrollRect.Right := Window.Right;
|
||||
ScrollRect.Bottom := Window.Bottom;
|
||||
|
||||
// might not need cliprect... might be able to pass scrollrect twice
|
||||
|
||||
ClipRect := ScrollRect;
|
||||
Fill.Attributes := 7;
|
||||
|
||||
DestCoord.X := Window.Left;
|
||||
DestCoord.Y := Window.Top - 1;
|
||||
|
||||
If Active Then
|
||||
ScrollConsoleScreenBuffer(ConOut, ScrollRect, ClipRect, DestCoord, PCharInfo(@Fill)^);
|
||||
ScrollConsoleScreenBuffer(ConOut, Window, Window, DestCoord, Fill);
|
||||
|
||||
Move (Buffer[2][1], Buffer[1][1], SizeOf(TConsoleLineRec) * 49);
|
||||
FillChar(Buffer[Window.Bottom + 1][1], SizeOf(TConsoleLineRec), #0);
|
||||
Move (Buffer[2][1], Buffer[1][1], SizeOf(TConsoleLineRec) * 49);
|
||||
FillChar (Buffer[Window.Bottom + 1][1], SizeOf(TConsoleLineRec), #0);
|
||||
End;
|
||||
|
||||
Procedure TOutputWindows.GetScreenImage (X1, Y1, X2, Y2: Byte; Var Image: TConsoleImageRec);
|
||||
|
|
Loading…
Reference in New Issue