Updates
This commit is contained in:
parent
de20817ca8
commit
cd4983db0b
|
@ -11,7 +11,7 @@ Procedure BitSet (B: Byte; Size: Byte; Var Temp; IsOn: Boolean);
|
||||||
Implementation
|
Implementation
|
||||||
|
|
||||||
Const
|
Const
|
||||||
Bit : Array[1..32] of LongInt = (
|
Bit : Array[1..32] of Cardinal = (
|
||||||
$00000001, $00000002,
|
$00000001, $00000002,
|
||||||
$00000004, $00000008,
|
$00000004, $00000008,
|
||||||
$00000010, $00000020,
|
$00000010, $00000020,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{$I M_OPS.PAS} {$R-}
|
|
||||||
|
|
||||||
Unit m_Input_Windows;
|
Unit m_Input_Windows;
|
||||||
|
|
||||||
|
{$I M_OPS.PAS}
|
||||||
|
|
||||||
Interface
|
Interface
|
||||||
|
|
||||||
Uses
|
Uses
|
||||||
|
@ -21,7 +21,7 @@ Type
|
||||||
Procedure AddBuffer (Ch: Char);
|
Procedure AddBuffer (Ch: Char);
|
||||||
Function RemapScanCode (ScanCode: Word; CtrlKeyState: dWord; Keycode: Word) : Byte;
|
Function RemapScanCode (ScanCode: Word; CtrlKeyState: dWord; Keycode: Word) : Byte;
|
||||||
Function ProcessQueue : Boolean;
|
Function ProcessQueue : Boolean;
|
||||||
Function KeyWait (MS: LongInt) : Boolean;
|
Function KeyWait (MS: Cardinal) : Boolean;
|
||||||
Function KeyPressed : Boolean;
|
Function KeyPressed : Boolean;
|
||||||
Function ReadKey : Char;
|
Function ReadKey : Char;
|
||||||
End;
|
End;
|
||||||
|
@ -168,7 +168,7 @@ Begin
|
||||||
Until NumRead = 0;
|
Until NumRead = 0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function TInputWindows.KeyWait (MS: LongInt) : Boolean;
|
Function TInputWindows.KeyWait (MS: Cardinal) : Boolean;
|
||||||
Begin
|
Begin
|
||||||
If BufPos <> BufSize Then Begin
|
If BufPos <> BufSize Then Begin
|
||||||
Result := True;
|
Result := True;
|
||||||
|
|
|
@ -85,6 +85,7 @@ End;
|
||||||
|
|
||||||
Function TIOBase.WriteBuf (Var Buf; Len: LongInt) : LongInt;
|
Function TIOBase.WriteBuf (Var Buf; Len: LongInt) : LongInt;
|
||||||
Begin
|
Begin
|
||||||
|
Result := 0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure TIOBase.BufFlush;
|
Procedure TIOBase.BufFlush;
|
||||||
|
@ -101,30 +102,37 @@ End;
|
||||||
|
|
||||||
Function TIOBase.ReadChar : Char;
|
Function TIOBase.ReadChar : Char;
|
||||||
Begin
|
Begin
|
||||||
|
Result := #0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function TIOBase.PeekChar (Num: Byte) : Char;
|
Function TIOBase.PeekChar (Num: Byte) : Char;
|
||||||
Begin
|
Begin
|
||||||
|
Result := #0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function TIOBase.ReadBuf (Var Buf; Len: LongInt) : LongInt;
|
Function TIOBase.ReadBuf (Var Buf; Len: LongInt) : LongInt;
|
||||||
Begin
|
Begin
|
||||||
|
Result := 0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function TIOBase.ReadLine (Var Str: String) : LongInt;
|
Function TIOBase.ReadLine (Var Str: String) : LongInt;
|
||||||
Begin
|
Begin
|
||||||
|
Result := 0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function TIOBase.WriteStr (Str: String) : LongInt;
|
Function TIOBase.WriteStr (Str: String) : LongInt;
|
||||||
Begin
|
Begin
|
||||||
|
Result := 0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function TIOBase.WriteLine (Str: String) : LongInt;
|
Function TIOBase.WriteLine (Str: String) : LongInt;
|
||||||
Begin
|
Begin
|
||||||
|
Result := 0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function TIOBase.WaitForData (TimeOut: LongInt) : LongInt;
|
Function TIOBase.WaitForData (TimeOut: LongInt) : LongInt;
|
||||||
Begin
|
Begin
|
||||||
|
Result := 0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
End.
|
End.
|
||||||
|
|
|
@ -65,7 +65,7 @@ Type
|
||||||
Function WaitForData (TimeOut: LongInt) : LongInt; Override;
|
Function WaitForData (TimeOut: LongInt) : LongInt; Override;
|
||||||
Function Connect (Address: String; Port: Word) : Boolean;
|
Function Connect (Address: String; Port: Word) : Boolean;
|
||||||
Function ResolveAddress (Host: String) : LongInt;
|
Function ResolveAddress (Host: String) : LongInt;
|
||||||
Procedure WaitInit (Port: Word);
|
Procedure WaitInit (NetInterface: String; Port: Word);
|
||||||
Function WaitConnection : TIOSocket;
|
Function WaitConnection : TIOSocket;
|
||||||
|
|
||||||
Function PeekChar (Num: Byte) : Char; Override;
|
Function PeekChar (Num: Byte) : Char; Override;
|
||||||
|
@ -564,7 +564,7 @@ Begin
|
||||||
Result := fpConnect(FSocketHandle, @Sin, SizeOf(Sin)) = 0;
|
Result := fpConnect(FSocketHandle, @Sin, SizeOf(Sin)) = 0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure TIOSocket.WaitInit (Port: Word);
|
Procedure TIOSocket.WaitInit (NetInterface: String; Port: Word);
|
||||||
Var
|
Var
|
||||||
SIN : TINetSockAddr;
|
SIN : TINetSockAddr;
|
||||||
Opt : LongInt;
|
Opt : LongInt;
|
||||||
|
@ -576,10 +576,12 @@ Begin
|
||||||
fpSetSockOpt (FSocketHandle, SOL_SOCKET, SO_REUSEADDR, @Opt, SizeOf(Opt));
|
fpSetSockOpt (FSocketHandle, SOL_SOCKET, SO_REUSEADDR, @Opt, SizeOf(Opt));
|
||||||
|
|
||||||
SIN.sin_family := PF_INET;
|
SIN.sin_family := PF_INET;
|
||||||
SIN.sin_addr.s_addr := 0;
|
// SIN.sin_addr.s_addr := 0;
|
||||||
|
SIN.sin_addr := StrToNetAddr(NetInterface);
|
||||||
SIN.sin_port := htons(Port);
|
SIN.sin_port := htons(Port);
|
||||||
|
|
||||||
{$IFDEF TNDEBUG}
|
{$IFDEF TNDEBUG}
|
||||||
|
TNLOG('Attempting to bind to interface ' + NetInterface + ' (' + strI2S(SIN.sin_addr.s_addr) + ')');
|
||||||
TNLOG('WaitInit Bind');
|
TNLOG('WaitInit Bind');
|
||||||
If fpBind(FSocketHandle, @SIN, SizeOf(SIN)) <> 0 Then
|
If fpBind(FSocketHandle, @SIN, SizeOf(SIN)) <> 0 Then
|
||||||
TNLOG('WaitInit Bind Failed')
|
TNLOG('WaitInit Bind Failed')
|
||||||
|
|
|
@ -171,37 +171,37 @@ End;
|
||||||
Procedure TOutputWindows.ClearEOL;
|
Procedure TOutputWindows.ClearEOL;
|
||||||
Var
|
Var
|
||||||
Count : Byte;
|
Count : Byte;
|
||||||
Res : LongInt;
|
BufSize : TCoord;
|
||||||
|
BufCoord : TCoord;
|
||||||
|
Region : TSmallRect;
|
||||||
Begin
|
Begin
|
||||||
Count := Window.Right - Cursor.X + 1;
|
Count := Window.Right - Cursor.X + 1;
|
||||||
|
|
||||||
FillDWord (Buffer[Cursor.Y + 1][Cursor.X + 1], Count, (Word(TextAttr) SHL 16) OR Word($0020));
|
FillDWord (Buffer[Cursor.Y + 1][Cursor.X + 1], Count, (Word(TextAttr) SHL 16) OR Word($0020));
|
||||||
|
|
||||||
If Active Then Begin
|
If Active Then Begin
|
||||||
FillConsoleOutputCharacter (ConOut, ' ', Count, Cursor, @Res);
|
BufSize.X := Count - 1;
|
||||||
FillConsoleOutputAttribute (ConOut, TextAttr, Count, Cursor, @Res);
|
BufSize.Y := 1;
|
||||||
|
BufCoord.X := 0;
|
||||||
|
BufCoord.Y := 0;
|
||||||
|
Region.Left := Cursor.X;
|
||||||
|
Region.Top := Cursor.Y;
|
||||||
|
Region.Right := Cursor.X + Count - 1;
|
||||||
|
Region.Bottom := Cursor.Y;
|
||||||
|
|
||||||
|
WriteConsoleOutput(ConOut, @Buffer[Cursor.Y + 1][Cursor.X + 1], BufSize, BufCoord, Region);
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
(*
|
(*
|
||||||
Procedure TOutputWindows.ClearEOL;
|
Procedure TOutputWindows.ClearEOL;
|
||||||
Var
|
Var
|
||||||
Buf : Array[1..80] of TCharInfo;
|
|
||||||
Count : Byte;
|
Count : Byte;
|
||||||
Res : LongInt;
|
Res : LongInt;
|
||||||
Begin
|
Begin
|
||||||
If Window.Right = Cursor.X Then Exit;
|
Count := Window.Right - Cursor.X + 1;
|
||||||
|
|
||||||
Count := 0;
|
FillDWord (Buffer[Cursor.Y + 1][Cursor.X + 1], Count, (Word(TextAttr) SHL 16) OR Word($0020));
|
||||||
|
|
||||||
While Count <= Window.Right - Cursor.X Do Begin
|
|
||||||
Inc (Count);
|
|
||||||
|
|
||||||
Buf[Count].Attributes := TextAttr;
|
|
||||||
Buf[Count].UnicodeChar := ' ';
|
|
||||||
End;
|
|
||||||
|
|
||||||
Move(Buf[1], Buffer[Cursor.Y + 1][Cursor.X + 1], SizeOf(TCharInfo) * Count);
|
|
||||||
|
|
||||||
If Active Then Begin
|
If Active Then Begin
|
||||||
FillConsoleOutputCharacter (ConOut, ' ', Count, Cursor, @Res);
|
FillConsoleOutputCharacter (ConOut, ' ', Count, Cursor, @Res);
|
||||||
|
|
Loading…
Reference in New Issue