program TestCrtWin;
uses
  Crt,
  CrtWin,
  Proc1Y,
  Kernel;

const
  cName     = 'TestCrtWin';       { jmeno jednotky }
  cVer      = 'v1.11, 8.1.2003';  { verze a datum jednotky }


const
  MaxProc=4;
  ARect : array[1..MaxProc] of TRect=(
           (X:  2; Y:  2; W: 38; H: 10),
           (X: 42; Y:  2; W: 38; H: 10),
           (X:  2; Y: 14; W: 38; H: 10),
           (X: 42; Y: 14; W: 38; H: 10));
  TbCol : array[1..MaxProc] of Byte=(
           $9,$a,$c,$7);

(*
{$F+}
procedure P1(C: Byte; Rect: TRect; S: String; AS, AR, AW: Byte);
{$F-}
var
  Win : PCrtWin;
  i   : Word;
begin
  Start('Proc1',8000,90,254);Exit;
  Win:=New(PCrtWin,Init(Rect,S,FrameD,AS,AR,AW,$20,0));
  if Win=nil then RunError(203);
  i:=0;
  repeat
    Win^.LockWin;
    WriteLn(i);
    Win^.UnLockWin;
    {$R-}
    Inc(i);
    {$R+}
    Wait(2);
  until FlEnd;
end;
*)
{$F+}
procedure P2(Rect: TRect; S: String; AS, AR, AW: Byte);
{$F-}
var
  Win : PCrtWin;
  SS  : String;
begin
  Start('Proc1',2000,101,254);Exit;
  Win:=New(PCrtWin,Init(Rect,S,FrameD,AS,AR,AW, 7,8));
  if Win=nil then RunError(203);
  repeat
    Win^.LockWin;
    Write('Zadej : ');
    ReadLn(SS);
    Win^.UnLockWin;
    if Length(SS)>0 then
    begin
      case SS[1] of
        'x' : FlEnd:=true;
      end;
    end;
  until FlEnd;
end;

var
  i,j,k : Byte;
begin
  DirectVideo:=false;
  TextMode(CO80{+Font8x8});

  StartMain(250,254);
  InitInterruptStack(1,8000);
  StartTimeSlicing($8);
{
  InitTraceFile('tracefl.xxx');
  TraceStatus:=[TraceStart,TraceTerminate,TraceSend,TraceReceive,
                TraceWait,TraceAbort,TraceTime,TraceName,TraceMessage];
}
  CrtInit;
  MainWin^.HiddenCursor;
  for k:=1 to 10{20} do
    for j:=1 to MaxProc-1 do
      for i:=1 to MaxProc do
        P1(i, ARect[j],'<< Proces '+Chr(Ord('@')+j)+' >>',$7,$7,TbCol[i]);

  P2(ARect[MaxProc],'<< Proces D >>',$7,$7,TbCol[MaxProc]);


  SetPriority(10,254);
  repeat
  until FlEnd;
  TerminateMain;
end.
