Code cleanup

This commit is contained in:
mysticbbs 2013-05-23 20:43:55 -04:00
parent 8c44cf02bb
commit 80571f1c8e
1 changed files with 27 additions and 24 deletions

View File

@ -1,18 +1,18 @@
{$I M_OPS.PAS}
Unit m_Input_Darwin; Unit m_Input_Darwin;
{$I M_OPS.PAS}
Interface Interface
Const Const
ttyIn = 0; ttyIn = 0;
ttyInBufSize = 256; ttyInBufSize = 256;
KeyBufferSize = 20; KeyBufferSize = 20;
ttyOut=1; ttyOut = 1;
InSize=256; InSize = 256;
AltKeyStr : string[38]='qwertyuiopasdfghjklzxcvbnm1234567890-='; AltKeyStr : string[38] = 'qwertyuiopasdfghjklzxcvbnm1234567890-=';
AltCodeStr : string[38]=#016#017#018#019#020#021#022#023#024#025#030#031#032#033#034#035#036#037#038+ AltCodeStr : string[38] = #016#017#018#019#020#021#022#023#024#025#030#031#032#033#034#035#036#037#038+
#044#045#046#047#048#049#050#120#121#122#123#124#125#126#127#128#129#130#131; #044#045#046#047#048#049#050#120#121#122#123#124#125#126#127#128#129#130#131;
Type Type
@ -26,15 +26,15 @@ Type
KeySend : longint; KeySend : longint;
Function ttyRecvChar : Char; Function ttyRecvChar : Char;
Procedure PushKey(Ch:char); Procedure PushKey (Ch : Char);
Function PopKey:char; Function PopKey : Char;
Procedure PushExt(b:byte); Procedure PushExt(b:byte);
Function FAltKey(ch:char):byte; Function FAltKey(ch:char):byte;
function sysKeyPressed: boolean; Function sysKeyPressed: boolean;
function KeyWait (MS: LongInt) : boolean; Function KeyWait (MS: LongInt) : boolean;
Function KeyPressed:Boolean; Function KeyPressed:Boolean;
Function ReadKey:char; Function ReadKey:char;
Procedure PurgeInputData; Procedure PurgeInputData;
Constructor Create; Constructor Create;
Destructor Destroy; Override; Destructor Destroy; Override;
(* (*
@ -177,9 +177,9 @@ begin
if (keysend <> keyput) or (incnt > 0) then exit; if (keysend <> keyput) or (incnt > 0) then exit;
fpFD_Zero(fdsin); fpFD_Zero (fdsin);
fpFD_Set(ttyin,fdsin); fpFD_Set (ttyin,fdsin);
if fpSelect(ttyin+1,@fdsin,nil,nil,ms) <= 0 then if fpSelect (ttyin + 1, @fdsin, nil, nil, ms) <= 0 then
result := false; result := false;
end; end;
@ -211,10 +211,12 @@ Begin
end; end;
ch:=ttyRecvChar; ch:=ttyRecvChar;
{Esc Found ?} {Esc Found ?}
CASE ch OF CASE ch OF
#27: begin #27: begin
State:=1; State:=1;
WaitMS(10); WaitMS(10);
@ -391,6 +393,7 @@ Begin
#127: PushKey(#8); #127: PushKey(#8);
else PushKey(ch); else PushKey(ch);
End; End;
ReadKey:=PopKey; ReadKey:=PopKey;
End; End;