home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / RADOOR30.ZIP / FOSSIL.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-04-10  |  40.2 KB  |  1,391 lines

  1. {╔═════════════════════════════════════════════════════════════════════════╗
  2.  ║                                                                         ║
  3.  ║                   (c) CopyRight LiveSystems 1990, 1994                  ║
  4.  ║                                                                         ║
  5.  ║ Author    : Gerhard Hoogterp                                            ║
  6.  ║ FidoNet   : 2:282/100.5   2:283/7.33                                    ║
  7.  ║ BitNet    : GERHARD@LOIPON.WLINK.NL                                     ║
  8.  ║                                                                         ║
  9.  ║ SnailMail : Kremersmaten 108                                            ║
  10.  ║             7511 LC Enschede                                            ║
  11.  ║             The Netherlands                                             ║
  12.  ║                                                                         ║
  13.  ║        This module is part of the RADoor BBS doorwriters toolbox.       ║
  14.  ║                                                                         ║
  15.  ╚═════════════════════════════════════════════════════════════════════════╝}
  16. {---------------------------------------------------------------------------|
  17.  
  18.  Description:
  19.  
  20.  The fossil unit handles ALL the input/output and timing needed for an door.
  21.  This includes local and remote I/O, putting the StatusLine on screen,
  22.  Checking for SysOp keys, User TimeOut management, Total time online
  23.  management, Carrier watchdogging etc. It's the most important unit
  24.  in the RADoor toolbox, and includes userhooks for output filtering,
  25.  SysOp Keys handling, the statusline. You can redefine the strings
  26.  send to the user as warning for timeout, LockOut, HangUp etc.
  27.  
  28.  See the documentation for a complete description.
  29.  
  30.  
  31.  
  32.  The compiler directives.
  33.  
  34.   Sorry, you can only use them if you have the sourcecode. See the docu
  35.   for more info on how to get it..
  36.  
  37.   CheckTimeOut     Enables/disables the usage of the TimeOut,
  38.                    TotalTimeAvailable, and the reaction on the
  39.                    GlobalInfo.OnlineStatus. All these functions
  40.                    are performed while checking the time.
  41.  
  42.   CheckCarrier     Enables/disables the watchdog functions and the showing
  43.                    of the StatusLine. (The Statusline is updated every
  44.                    minute while checking the CARRIER.
  45.  
  46.   UseDRIVERunit    Enables/disables the usage of the Driver unit. This
  47.                    means that local output is send to a special
  48.                    ANSI text-file (to remain the ability to use the
  49.                    CRT functions!) The internal local ANSI/AVT0+/ANSIMusic
  50.                    handling is disabled
  51.                    B.t.w. This also means that a clearscreen clears the
  52.                    WHOLE Screen! Including status line!
  53.  
  54.   MakeDVAwear      Enables/disables the usage of DesqView calls to give
  55.                    back timeslices while waiting for userinput during
  56.                    the AskKey and ReadLnF routines. Timeslices are also
  57.                    returned when the output buffer is full.
  58.  
  59. |---------------------------------------------------------------------------}
  60. {$Define CheckTimeOut}    { Enables/disables Timeout checking               }
  61. {$Define CheckCarrier}    { Enables/disables Internal carrier checking      }
  62. {$Define UseDRIVERunit}   { Enables/disables the usage of the DRIVER unit   }
  63. {$Define MakeDVAwear}     { Enables/disables the usage of the Desqview unit }
  64.  
  65. Unit Fossil;
  66. Interface
  67. Uses Dos,
  68.      CRT,
  69.  
  70.      GlobInfo,  { Global information on the System }
  71.  
  72.      {$IfDef MakeDVAwear}
  73.         DesqView,  { Desqview support procedures }
  74.      {$EndIf}
  75.  
  76.      {$IfDef UseDriverUnit}
  77.        Driver,     { Local ANSI, AVT/0+, AnsiMusic}
  78.      {$EndIf}
  79.  
  80.      Timer,
  81.      LowLevel,     { LowLevel procedures and functions }
  82.      KeyDefs;      { Keyboard definitions }
  83.  
  84.  
  85. {----------------------------------------------------------------------------|
  86.  The input filter type and some predefined constates for the ReadLnF
  87.  procedure.
  88. |----------------------------------------------------------------------------}
  89.  
  90. Type  InpFilterType = Set Of Char;
  91.  
  92. Const FileCharSet      = [' '..'~'] - [' ',',','=','+','<','>','|','"','[',']'];
  93.       NumCharSet       = ['0'..'9','-','+'];
  94.       RealCharSet      = NumCharSet + ['.','E','e'];
  95.       AllCharSet       = [' '..#254];
  96.       PhoneCharSet     = ['0'..'9','-'];
  97.       USAPhoneCharSet  = ['0'..'9','(',')',' '];
  98.  
  99. {----------------------------------------------------------------------------|
  100.   The default strings for the PressEnterOrStop procedure and the
  101.   PressEnter procedure.
  102. |----------------------------------------------------------------------------}
  103.       UsedStopKey : Char = 'S';
  104.  
  105.       PressEnterOrStopString : String =
  106.          'Press [ENTER] to continue, [S] to stop: ';
  107.  
  108.       PressEnterString : String =
  109.          'Press [ENTER] to continue: ';
  110.  
  111. {----------------------------------------------------------------------------|
  112.   The default values for the warning, hangup, lockout etc. strings
  113. |----------------------------------------------------------------------------}
  114.  
  115. {$IfDef CheckTimeOut}
  116.  
  117.       Warning1String   : String[80] =
  118.          #13#10'--- Warning, you have only 2 minutes left.';
  119.  
  120.       Warning2String   : String[80] =
  121.          #13#10'--- Warning, you have only 1 minute left.';
  122.  
  123.       TimeUpString     : String[80] =
  124.          #13#10'--- You reached your daily limit.';
  125.  
  126.       AttentionString  : String[20] =
  127.          'Hello???';
  128.  
  129.       LockOutString    : String[80] =
  130.          #13#10'--- You have been locked out of the system. Don''t call back...';
  131.  
  132.       HangUpString     : String[80] =
  133.          #13#10'--- The SysOp threw you out..';
  134.  
  135. {$EndIf}
  136.  
  137. {----------------------------------------------------------------------------|
  138.   KeyString is the type for a list of keys used by the AskKey function
  139. |----------------------------------------------------------------------------}
  140.  
  141. Type KeysString       = String[40];
  142.  
  143. {----------------------------------------------------------------------------|
  144.   The userhook types.
  145. |----------------------------------------------------------------------------}
  146.  
  147.      OutputFilterType = Procedure(Var InStr : String);
  148.      SysopKeyType     = Procedure (Key : Char);
  149.      StatLineType     = Procedure;
  150.  
  151.  
  152. {----------------------------------------------------------------------------|
  153.   And the Fossil Object itself.
  154. |----------------------------------------------------------------------------}
  155.  
  156.  
  157.      FossilObject = Object
  158.                       Port      : Word;     { Current Comport            }
  159.                       BaudRate  : LongInt;  { Current Baudrate           }
  160.                       Error     : Integer;  { Error number               }
  161.                       Emergency : Boolean;  { Is set if the carrier is   }
  162.                                             { dropped or the user timed  }
  163.                                             { out                        }
  164.  
  165.                       LocalEcho : Boolean;  { echo to local console      }
  166.                       LocalInp  : Boolean;  { Input from local cons.     }
  167.  
  168.                       RemoteEcho: Boolean;  { Echo to remote console     }
  169.                       RemoteInp : Boolean;  { Input from remote cons.    }
  170.  
  171.                       EchoStars : Boolean;  { Echo stars                 }
  172.                       KeyBuffer : Char;     { Buffer for SmartReadKey    }
  173.  
  174.                       {$IfDef CheckTimeOut}
  175.                         Reminder      : Byte;        { No. Reminders        }
  176.                         MaxWarning    : Byte;        { Max warnings         }
  177.                         TimeOut       : TimerObject; { Timout Time          }
  178.                         TimeOutMin    : Word;        { Timeout in minutes   }
  179.                         WarningStatus : Byte;        { Internal status byte }
  180.                       {$EndIf}
  181.  
  182.                       { The userhooks }
  183.  
  184.                       InputFilter        : InpFilterType;
  185.                       OutputFilter       : OutputfilterType;
  186.                       SysopKeys          : SysopKeyType;
  187.                       StatusLine         : StatLineType;
  188.  
  189.                       { If NoSystemMsg is true, the programmer has to   }
  190.                       { Send warnings himself! See GlobalInfo           }
  191.  
  192.                       NoSystemMsg        : Boolean;
  193.  
  194.                       { The basic i/o functirons }
  195.  
  196.                       Procedure AssignF(P : Word; Baud : LongInt);
  197.                       Procedure CloseF;
  198.                       Function KeyPressedF:Boolean;
  199.                       Function ReadKeyF:Char;
  200.                       Procedure ReadLnF(Var S : String; MaxLength : Byte);
  201.                       Procedure ClrScrF;
  202.                       Procedure WriteF(S : String);
  203.                       Procedure WriteLnF(S : String);
  204.  
  205.  
  206.                       { The controle/check routines }
  207.  
  208.                       Function FossError:Integer;
  209.                       Function Carrier:Boolean;
  210.                       Function OutPutEmpty:Boolean;
  211.                       Procedure HangUp;
  212.  
  213.                       { the userhook routines }
  214.  
  215.                       Procedure InitOutputFilter(Filter : OutputFilterType);
  216.                       Procedure OutputFilterOff;
  217.                       Procedure OutputFilterOn;
  218.                       Procedure InitSysopKeys(Keys : SysOpKeyType);
  219.                       Procedure InitInputFilter(CharSet : InpFilterType);
  220.                       Procedure InitStatLine(Stat : StatLineType);
  221.  
  222.                       { Added I/O Routines }
  223.  
  224.                       Function SmartReadKey:Char;
  225.                       Function AskKey(Keys : KeysString; Default : Char):Char;
  226.                       Function AskKeyTimeOut( Keys       : KeysString;
  227.                                               Default    : Char;
  228.                                               Timer      : Word;
  229.                                               TimeOutKey : Char):Char;
  230.                       Procedure ReadPicture(Var Line : String;Picture : String);
  231.                       Function PressEnterOrStop:Boolean;
  232.                       Procedure PressEnter;
  233.                       Procedure PressANYKey;
  234.                       Procedure GotoXyF(X,Y : Byte);
  235.  
  236.                       { Internal Timeout/Total time checking routines }
  237.  
  238.                       {$IfDef CheckTimeOut}
  239.                         Procedure InitTimer( MaxWarn      : Byte;
  240.                                              TimeOutTime  : Word);
  241.                         Procedure ResetTimeOut;
  242.                         Function CheckTimeOut:Boolean;
  243.                       {$EndIf}
  244.  
  245.                       { And some lowlevel routines.. }
  246.  
  247.                         Procedure ClearInput;
  248.                         Procedure ClearOutput;
  249.  
  250.                       {$IfDef useDRIVERUnit}
  251.                         Function DetectAnsi:Boolean;
  252.                       {$EndIf}
  253.  
  254.                     End;
  255.  
  256.  
  257. {----------------------------------------------------------------------------|
  258.   Default userhooks. To make sure nothing strange happens when the programmer
  259.   Doesn't install hooks!
  260. |----------------------------------------------------------------------------}
  261.  
  262. Procedure NoFilter(Var InStr : String);
  263. Procedure NoSysopKeys(Key : Char);
  264. Procedure NoStatLine;
  265.  
  266. Implementation
  267.  
  268. {----------------------------------------------------------------------------|
  269.  the default userhooks.
  270. |----------------------------------------------------------------------------}
  271.  
  272. Procedure NoFilter(Var InStr : String);
  273. Begin
  274. End;
  275.  
  276. Procedure NoSysopKeys(Key : Char);
  277. Begin
  278. End;
  279.  
  280. Procedure NoStatLine;
  281. Begin
  282. End;
  283.  
  284.  
  285. {----------------------------------------------------------------------------|
  286.   The TIME checking procedures and functions
  287. |----------------------------------------------------------------------------}
  288.  
  289.  
  290. {$IfDef CheckTimeOut}
  291.  
  292. Var MinuteTick : TimerObject;
  293.  
  294. Procedure FossilObject.InitTimer( MaxWarn      : Byte;
  295.                                   TimeOutTime  : Word);
  296. Begin
  297. WarningStatus:=2;
  298.  
  299. TimeOut.SetTimer(TimeOutTime*10);
  300. TimeOutMin:=TimeOutTime;
  301. Reminder:=0;
  302. MaxWarning:=MaxWarn;
  303. End;
  304.  
  305.  
  306.  
  307. Function FossilObject.CheckTimeOut:Boolean;
  308. Var Count : Byte;
  309. Begin
  310. CheckTimeOut:=False;
  311.  
  312. { Check the total time a user has. Send warnings if it drops below 3 min. }
  313.  
  314. If GlobalInfo.MinRemaining<3
  315.    Then Begin
  316.         Case GlobalInfo.MinRemaining OF
  317.          2  : Begin
  318.               If WarningStatus=2
  319.                  Then Begin
  320.                       GlobalInfo.SystemStatus:=S_Warning1;
  321.                       If Not NoSystemMsg
  322.                          Then WriteLnF(Warning1String);
  323.                       End;
  324.               WarningStatus:=1;
  325.               End;
  326.          1:   Begin
  327.               If WarningStatus>=1
  328.                  Then Begin
  329.                       GlobalInfo.SystemStatus:=S_Warning2;
  330.                       If Not NoSystemMsg
  331.                          Then WriteLnF(Warning2String);
  332.                       End;
  333.               WarningStatus:=0;
  334.               End;
  335.          0  : Begin
  336.               GlobalInfo.SystemStatus:=S_TimeUp;
  337.               If Not NoSystemMsg
  338.                  Then WriteLnF(TimeUpString);
  339.               CheckTimeOut:=True;
  340.               End;
  341.          End; {Case}
  342.          End
  343.    Else WarningStatus:=2;
  344.  
  345. { Check inactivity and send a warning }
  346.  
  347. If TimeOut.TimeUp
  348.    Then Begin
  349.         If Reminder<MaxWarning
  350.            Then Begin
  351.                 WriteF(AttentionString+#7#7);
  352.                 Delay(3000);
  353.                 For Count:=1 To Length(AttentionString) Do
  354.                   WriteF(#8' '#8);
  355.                 TimeOut.SetTimer(TimeOutMin*10);
  356.                 Inc(Reminder);
  357.                 End
  358.            Else CheckTimeOut:=True;
  359.         End;
  360.  
  361.  
  362. { Check the results of sysop keys. }
  363.  
  364. If GlobalInfo.OnlineStatus<>Normal
  365.    Then Begin
  366.         Case GlobalInfo.OnlineStatus Of
  367.          HangUpLine : Begin
  368.                       WriteLnF(HangUpString);
  369.                       Delay(100);
  370.                       HangUp;
  371.                       CheckTimeOut:=True;
  372.                       End;
  373.          LockOutUser: Begin
  374.                       WriteLnF(LockOutString);
  375.                       Delay(100);
  376.                       HangUp;
  377.                       GlobalInfo.UserSecurity:=0;
  378.                       GlobalInfo.MinRemaining:=0;
  379.                       CheckTimeOut:=True;
  380.                       End;
  381.         End; {Case}
  382.         End;
  383. End;
  384.  
  385. Procedure FossilObject.ResetTimeOut;
  386. Begin
  387. TimeOut.SetTimer(TimeOutMin*10);
  388. Reminder:=0;
  389. End;
  390. {$EndIf} {CheckTimeout}
  391.  
  392.  
  393. {----------------------------------------------------------------------------|
  394.   The fossil methodes
  395. |----------------------------------------------------------------------------}
  396.  
  397. Const Input_Available   = $01;
  398.       Input_OverRun     = $02;
  399.       OutPut_Available  = $10;
  400.       OutPut_Empty      = $20;
  401.  
  402.       Carrier_Detected  = $80;
  403.  
  404. {$IfNDef UseDRIVERUnit}
  405.   Var   ANSI : Text;
  406. {$EndIf}
  407.  
  408. {----------------------------------------------------------------------------|
  409.   Open and initialize the fossil and the FossilObject.
  410. |----------------------------------------------------------------------------}
  411.  
  412. Procedure FossilObject.AssignF(P : Word; Baud : LongInt);
  413. Var Regs : Registers;
  414. Begin
  415. LocalEcho  := True;
  416. RemoteEcho := True;
  417. LocalInp   := True;
  418. RemoteInp  := True;
  419.  
  420. {$IfDef UseDRIVERunit}
  421.   Driver.BeQuiet:=Not GlobalInfo.LocalNoise;
  422. {$EndIf}
  423.  
  424. EchoStars  := False;
  425. KeyBuffer  := #00;
  426.  
  427. Emergency  := False;
  428.  
  429. InitOutputFilter(NoFilter);
  430. InitSysopKeys(NoSysopKeys);
  431. InitStatLine(NoStatLine);
  432. InitInputFilter(AllCharSet);
  433.  
  434. NoSystemMsg:=False;
  435.  
  436. {$IfNDef UseDriverUnit}
  437.  Assign(ANSI,'');
  438.  Rewrite(ANSI);
  439. {$Else}
  440.  Driver.NoColor:=GlobalInfo.LocalMono;
  441. {$EndIf}
  442.  
  443. Port       := P;
  444. BaudRate   := Baud;
  445. Error      := 0;
  446. If BaudRate=0
  447.    Then Exit;
  448.  
  449. BaudRate:=BaudRate Div 100;
  450.  
  451. Regs.Ah:=$04;
  452. Regs.Dx:=Port;
  453. Intr($14,Regs);
  454. If (Regs.AX<>$1954)
  455.    Then Begin
  456.         Error:= -1; { Fossil not found }
  457.         Exit;
  458.         End;
  459.  
  460. Regs.Ah:=$00;
  461. Case BaudRate Of
  462.  3    : Regs.Al:=$43;
  463.  6    : Regs.Al:=$63;
  464.  12   : Regs.Al:=$83;
  465.  24   : Regs.Al:=$A3;
  466.  48   : Regs.Al:=$C3;
  467.  96   : Regs.Al:=$E3;
  468.  192  : Regs.Al:=$03;
  469.  384  : Regs.Al:=$23;
  470.  Else   Regs.AL:=$23;  { 14k4 ?! }
  471. End;
  472. Regs.Dx:=Port;
  473. Intr($14,Regs);
  474.  
  475. Regs.Ah:=$06;
  476. Regs.Al:=$01;
  477. Regs.Dx:=Port;
  478. Intr($14,Regs);
  479.  
  480. Regs.Ah:=$09;
  481. Regs.Dx:=Port;
  482. Intr($14,Regs);
  483.  
  484. Regs.Ah:=$0A;
  485. Regs.Dx:=Port;
  486. Intr($14,Regs);
  487. End;
  488.  
  489. {----------------------------------------------------------------------------|
  490.   Close the fossil.
  491. |----------------------------------------------------------------------------}
  492.  
  493. Procedure FossilObject.CloseF;
  494. Var Regs : Registers;
  495. Begin
  496.  
  497. If GlobalInfo.OnlineStatus = WarnOnLeaving
  498.    Then Begin
  499.         RemoteEcho:=False;
  500.         {$IfDef UseDriverUnit}
  501.           Driver.BeQuiet:=False;
  502.         {$EndIf}
  503.         WriteF(#7);
  504.         End;
  505.  
  506. {$IfNDef UseDriverUnit}
  507.  Close(ANSI);
  508. {$EndIf}
  509.  
  510. If BaudRate=0
  511.    Then Exit;
  512.  
  513. Regs.Ah:=$05;
  514. Regs.Dx:=Port;
  515. Intr($14,Regs);
  516. End;
  517.  
  518. {----------------------------------------------------------------------------|
  519.   Return the last errorlevel and clear the interal ERROR variable.
  520. |----------------------------------------------------------------------------}
  521.  
  522.  
  523. Function FossilObject.FossError:Integer;
  524. Begin
  525. FossError:=Error;
  526. Error:=0;
  527. End;
  528.  
  529. {----------------------------------------------------------------------------|
  530.   Check for the presence of a carrier, and update the statusline.
  531.   Also reset the minute TICK timer if nessecary
  532. |----------------------------------------------------------------------------}
  533.  
  534.  
  535. Function FossilObject.Carrier:Boolean;
  536. Var Regs : Registers;
  537. Begin
  538. {$IfDef UseDriverUnit}
  539. Driver.BeQuiet:=Not GlobalInfo.LocalNoise;
  540. {$EndIf}
  541. StatusLine;
  542.  
  543. {$IfDef CheckTimeOut}
  544. If MinuteTick.TimeUp
  545.    Then Begin
  546.         Dec(GlobalInfo.MinRemaining);
  547.         MinuteTick.SetTimer(600);
  548.         End;
  549. {$EndIf}
  550.  
  551. If BaudRate=0
  552.    Then Begin
  553.         Carrier:=True;
  554.         Exit;
  555.         End;
  556. With Regs Do
  557.  Begin
  558.  AH:=$03;
  559.  DX:=Port;
  560.  End;
  561. Intr($14,Regs);
  562. Carrier:=(Regs.AL And Carrier_Detected) = Carrier_Detected;
  563. End;
  564.  
  565. {----------------------------------------------------------------------------|
  566.  Check if the outputbuffer is empty
  567. |----------------------------------------------------------------------------}
  568.  
  569.  
  570. Function FossilObject.OutPutEmpty:Boolean;
  571. Var Regs : Registers;
  572. Begin
  573. If Emergency Or (BaudRate=0)
  574.    Then Begin
  575.         OutPutEmpty:=True;
  576.         Exit;
  577.         End;
  578. With Regs Do
  579.  Begin
  580.  AH:=$03;
  581.  DX:=Port;
  582.  End;
  583. Intr($14,Regs);
  584. OutputEmpty:=(Regs.AH And OutPut_Empty) = OutPut_Empty;
  585. End;
  586.  
  587. {----------------------------------------------------------------------------|
  588.   Hangup the line by toggling the DTR
  589. |----------------------------------------------------------------------------}
  590.  
  591.  
  592. Procedure FossilObject.HangUp;
  593. Var Regs : Registers;
  594. Begin
  595. If Emergency Or (BaudRate=0)
  596.    Then Exit;
  597.  
  598. With Regs Do
  599.  Begin
  600.  Regs.Ah:=$06;  { DTR Down }
  601.  Regs.Al:=$00;
  602.  Regs.Dx:=Port;
  603.  Intr($14,Regs);
  604.  
  605.  Delay(200);
  606.  
  607.  Regs.Ah:=$06;  { DTR Up   }
  608.  Regs.Al:=$01;
  609.  Regs.Dx:=Port;
  610.  Intr($14,Regs);
  611.  End;
  612. End;
  613.  
  614. {----------------------------------------------------------------------------|
  615.   Check if a local or remote key was pressed.
  616. |----------------------------------------------------------------------------}
  617.  
  618.  
  619. Function FossilObject.KeyPressedF:Boolean;
  620. Var Regs   : Registers;
  621.     Local  : Boolean;
  622.     Remote : Boolean;
  623. Begin
  624. {$IfDef CheckCarrier}
  625.   Emergency:=Not Carrier;
  626. {$EndIf}
  627.  
  628. If Emergency
  629.    Then KeyPressedF:=False;
  630.  
  631. {$IfDef CheckTimeOut}
  632.   Emergency:=Emergency Or CheckTimeOut;
  633. {$EndIf}
  634.  
  635. Local:=False;
  636. Remote:=False;
  637.  
  638. Local:=CRT.KeyPressed;
  639. If BaudRate=0
  640.    Then Begin
  641.         KeyPressedF:=Local And LocalInp;
  642.         Exit;
  643.         End;
  644.  
  645. With Regs Do
  646.  Begin
  647.  AH:=$03;
  648.  DX:=Port;
  649.  Intr($14,Regs);
  650.  End;
  651. Remote:=(Regs.AH And Input_Available)=Input_Available;
  652.  
  653. KeyPressedF := (Local And LocalInp) Or
  654.                (Remote And RemoteInp);
  655. End;
  656.  
  657.  
  658. {----------------------------------------------------------------------------|
  659.   Read a local or remote key, and check for SysOp keys.
  660.   Note: If a SysOp key was detected, character #FF is returned!
  661.         Check this as a special case if you use this routine.
  662. |----------------------------------------------------------------------------}
  663.  
  664. Function FossilObject.ReadKeyF:Char;
  665. Var Regs : Registers;
  666.     Dum  : Char;
  667. Begin
  668.  
  669. {$IfDef CheckCarrier}
  670.   Emergency:=Not Carrier;
  671. {$EndIf}
  672.  
  673. {$IfDef CheckTimeOut}
  674.   Emergency:=Emergency Or CheckTimeOut;
  675. {$EndIf}
  676.  
  677. If Emergency
  678.    Then Exit;
  679.  
  680. If LocalInp And
  681.    Crt.KeyPressed
  682.    Then Begin
  683.         {$IfDef CheckTimeOut}
  684.           ResetTimeOut;
  685.         {$EndIf}
  686.         Dum:=CRT.ReadKey;
  687.         If Dum=#00
  688.            Then Begin
  689.                 Dum:=CRT.ReadKey;
  690.                 SysopKeys(Dum);
  691.                 ReadKeyF:=#$FF;
  692.                 End
  693.            Else ReadKeyF:=Dum;
  694.         Exit;
  695.         End;
  696.  
  697. If RemoteInp And (BaudRate>0)
  698.    Then Begin
  699.         With Regs Do
  700.          Begin
  701.          AH:=$03;
  702.          DX:=Port;
  703.          End;
  704.         Intr($14,Regs);
  705.         If (Regs.AH And Input_Available)=Input_Available
  706.            Then Begin
  707.                 {$IfDef CheckTimeOut}
  708.                   ResetTimeOut;
  709.                 {$EndIf}
  710.                 With Regs Do
  711.                  Begin
  712.                  AH:=$02;
  713.                  DX:=Port;
  714.                  End;
  715.                 Intr($14,Regs);
  716.                 ReadKeyF:=Chr(Regs.AL);
  717.                 End;
  718.         End;
  719.  
  720. End;
  721.  
  722. {----------------------------------------------------------------------------|
  723.   Read a local or remote key, and check for SysOp keys.
  724.   Also check for special ANSI sequences and return extended keys for
  725.   ArrowUp/Down/Left/Right
  726.  
  727.   Note: If a SysOp key was detected, character #FF is returned!
  728.         Check this as a special case if you use this routine.
  729. |----------------------------------------------------------------------------}
  730.  
  731. Function FossilObject.SmartReadKey:Char;
  732. Var Regs : Registers;
  733.     Dum  : Char;
  734.     Key  : Char;
  735. Begin
  736. {$IfDef CheckCarrier}
  737.   Emergency:= Not Carrier;
  738. {$EndIf}
  739.  
  740. {$IfDef CheckTimeOut}
  741.   Emergency:=Emergency Or CheckTimeOut;
  742. {$EndIf}
  743.  
  744. If Emergency
  745.    Then Exit;
  746.  
  747. If KeyBuffer<>#00
  748.    Then Begin
  749.         SmartReadKey:=KeyBuffer;
  750.         KeyBuffer:=#00;
  751.         Exit;
  752.         End;
  753.  
  754. If LocalInp And
  755.    Crt.KeyPressed
  756.    Then Begin
  757.  
  758.         {$IfDef CheckTimeOut}
  759.           ResetTimeOut;
  760.         {$EndIf}
  761.  
  762.         Dum:=CRT.ReadKey;
  763.         If Dum=#00
  764.            Then KeyBuffer:=CRT.ReadKey
  765.            Else KeyBuffer:=#00;
  766.  
  767.         If (Dum=#00) And
  768.            (Not (KeyBuffer In [ArrUp,ArrDn,ArrLft,ArrRt,PgUpK,PgDnK,HomeK,EndK]))
  769.            Then begin
  770.                 SysopKeys(KeyBuffer);
  771.                 KeyBuffer:=#00;
  772.                 SmartReadKey:=#$FF;
  773.                 End
  774.            Else SmartReadKey:=Dum;
  775.         Exit;
  776.         End;
  777.  
  778. If RemoteInp And
  779.    (BaudRate>0)
  780.    Then Begin
  781.         LocalInp:=False;
  782.         If KeyPressedF
  783.            Then Begin
  784.                 {$IfDef CheckTimeOut}
  785.                   ResetTimeOut;
  786.                 {$EndIf}
  787.                 Dum:=ReadKeyF;
  788.                 If Dum In [^D,^E,^X,^S,^R,^C,^W,^P]
  789.                    Then Begin
  790.                         SmartReadKey:=#00;
  791.                         Case Dum Of
  792.                          ^E  : KeyBuffer:=ArrUp;
  793.                          ^X  : KeyBuffer:=ArrDn;
  794.                          ^S  : KeyBuffer:=ArrLft;
  795.                          ^D  : KeyBuffer:=ArrRt;
  796.                          ^R  : KeyBuffer:=PgUpK;
  797.                          ^C  : KeyBuffer:=PgDnK;
  798.                          ^W  : KeyBuffer:=HomeK;
  799.                          ^P  : KeyBuffer:=EndK;
  800.                          ^A  : KeyBuffer:=CArrLft;
  801.                          ^F  : KeyBuffer:=CArrRt;
  802.                          ^V  : KeyBuffer:=InsK;
  803.                          ^G  : KeyBuffer:=DelK;
  804.                          Else  SmartReadKey:=Dum;
  805.                         End; {Case}
  806.                         End
  807.                    Else SmartReadKey:=Dum;
  808.                 End;
  809.         LocalInp:=True;
  810.         End;
  811.  
  812.  
  813. End;
  814.  
  815. {----------------------------------------------------------------------------|
  816.   Wait until a key in the range contained in KEYS is pressed. This procedure
  817.   it's main purpose is to make menus more simple. DON'T use it for arcade
  818.   style purposes! Use SmartReadKey there...
  819.  
  820.   If the carrier is dropped or the user times out the default char is send
  821.   back. Make it something to bail out of the program. It's NOT the character
  822.   to give back when the user presses enter. (You can handle that yourself
  823.   by adding #13 to the KEYS list..)
  824. |----------------------------------------------------------------------------}
  825.  
  826. Function FossilObject.AskKey(Keys : KeysString; Default : Char):Char;
  827. Var Dum : Char;
  828. Begin
  829. If Emergency
  830.    Then Begin
  831.         AskKey:=Default;
  832.         Exit;
  833.         End;
  834. WriteF(' '#8);
  835. Repeat
  836.  If KeyPressedF
  837.     Then Begin
  838.          {$IfDef CheckTimeOut}
  839.            ResetTimeOut;
  840.          {$EndIf}
  841.          Dum:=ReadKeyF;
  842.          If (Pos(UpCase(Dum),Keys)>0) And
  843.             (Dum<>#$FF) { Local Sysop key's send an #$FF back! }
  844.             Then Begin
  845.                  AskKey:=Dum;
  846.                  If EchoStars
  847.                     Then Dum:='*';
  848.                  WriteF(Dum);
  849.                  Exit;
  850.                  End;
  851.          End
  852.     Else {$IfDef MakeDVAwear}
  853.            DV_Pause;
  854.          {$EndIf}
  855.  
  856. {$IfDef CheckCarrier}
  857.   Emergency:=Not Carrier;
  858. {$EndIf}
  859.  
  860. {$IfDef CheckTimeOut}
  861.   Emergency:=Emergency OR checkTimeOut;
  862. {$EndIf}
  863.  
  864. Until Emergency;
  865. AskKey:=Default;
  866. End;
  867.  
  868. Function FossilObject.AskKeyTimeOut( Keys       : KeysString;
  869.                                      Default    : Char;
  870.                                      Timer      : Word;
  871.                                      TimeOutKey : Char):Char;
  872. Var Dum      : Char;
  873.     WaitTime : TimerObject;
  874.  
  875. Begin
  876. If Emergency
  877.    Then Begin
  878.         AskKeyTimeOut:=Default;
  879.         Exit;
  880.         End;
  881. WaitTime.SetTimer(Timer);
  882. WriteF(' '#8);
  883. Repeat
  884.  If KeyPressedF
  885.     Then Begin
  886.          {$IfDef CheckTimeOut}
  887.            ResetTimeOut;
  888.          {$EndIf}
  889.          Dum:=ReadKeyF;
  890.          If (Pos(UpCase(Dum),Keys)>0) And
  891.             (Dum<>#$FF) { Local Sysop key's send an #$FF back! }
  892.             Then Begin
  893.                  AskKeyTimeOut:=Dum;
  894.                  If EchoStars
  895.                     Then Dum:='*';
  896.                  WriteF(Dum);
  897.                  Exit;
  898.                  End;
  899.          End
  900.     Else {$IfDef MakeDVAwear}
  901.            DV_Pause;
  902.          {$EndIf}
  903.  
  904. {$IfDef CheckCarrier}
  905.   Emergency:=Not Carrier;
  906. {$EndIf}
  907.  
  908. {$IfDef CheckTimeOut}
  909.   Emergency:=Emergency OR checkTimeOut;
  910. {$EndIf}
  911.  
  912. Until Emergency Or WaitTime.TimeUp;
  913. If Not Emergency
  914.    Then AskKeyTimeOut:=TimeOutKey
  915.    Else AskKeyTimeOut:=Default;
  916. End;
  917.  
  918. {----------------------------------------------------------------------------|
  919.  Read a line with the maximal length MaxLengt. The procedure recognises
  920.  the RA ^X command to clear the line, BackSpace to clear the previouse
  921.  character and CarriageReturn to accept the input. Other characters typed
  922.  by the user are checked against the InputFilter.
  923. |----------------------------------------------------------------------------}
  924.  
  925. Procedure FossilObject.ReadLnF(Var S : String; MaxLength : Byte);
  926. Var Count : Byte;
  927.     Key   : Char;
  928.     Remove: Byte;
  929. Begin
  930. For Count:=1 To MaxLength Do
  931.  WriteF(' ');
  932. For Count:=1 To MaxLength Do
  933.  WriteF(#8);
  934.  
  935. Count:=Length(S);
  936. WriteF(S);
  937. Repeat
  938.  If KeyPressedF
  939.     Then Begin
  940.          Key := ReadKeyF;
  941.          {$IfDef CheckTimeOut}
  942.            ResetTimeout;
  943.          {$EndIf}
  944.          Case Key Of
  945.            #13  : Exit;
  946.            #8   : Begin
  947.                   If Count>0
  948.                      Then Begin
  949.                           Dec(S[0]);
  950.                           WriteF(#8' '#8);
  951.                           Dec(Count);
  952.                           End;
  953.                   End;
  954.            ^X   : Begin
  955.                   If Count>0
  956.                      Then Begin
  957.                           For Remove:= Count DownTo 1 Do
  958.                             WriteF(#8' '#8);
  959.                           S:='';
  960.                           Count:=0;
  961.                           End;
  962.                   End;
  963.            #$FF : ; { Local SysopKeys send an #$FF back! }
  964.            Else Begin
  965.                 If (Count=MaxLength) Or
  966.                    (
  967.                     (Not (Key In InputFilter)) AND
  968.                     (InputFilter<> [])
  969.                    )
  970.                    Then WriteF(#7)
  971.                    Else Begin
  972.                         S:=S+Key;
  973.                         If EchoStars
  974.                            Then Key:='*';
  975.                         WriteF(Key);
  976.                         Inc(Count);
  977.                         End;
  978.                 End;
  979.           End; {Case}
  980.          End
  981.     Else {$IfDef MakeDVAwear}
  982.            DV_Pause;
  983.          {$EndIf};
  984.  
  985. {$IfDef CheckTimeOut}
  986.   Emergency:=Emergency Or CheckTimeOut;
  987. {$EndIf}
  988.  
  989. Until Emergency;
  990. End;
  991.  
  992. {----------------------------------------------------------------------------|
  993.  Read a string defined by a picture string which defines the input on a
  994.  certain character. Defined picture items are:
  995.    X  Any Character A..Z in any case
  996.    U  Force uppercase
  997.    L  Force lowercase
  998.    N  Numerical char 0..9
  999.    Z  Nummerical char, but if 0, replace with space when finished
  1000.    S  Sign, +/-/' '
  1001.  
  1002. All other chars are shown on the screen. F.e. an american phonenumber:
  1003.  
  1004.    (NNN) NNNN-NNNN
  1005.  
  1006. b.t.w. please don't FORCE a USA phone number, make it optional.. It wouldn't
  1007. be the first time that I (and I guess more ppl outside usa have this
  1008. experience) try to log on an american board, and can't get in as there's
  1009. no way to force my phonenumber into this format.. (NNN-NNNNNN)
  1010.  
  1011. A dutch ZIP code (postal code)
  1012.  
  1013.    NNNN UU
  1014.  
  1015. An amout of money:
  1016.  
  1017.    fZZNN.NN
  1018.  
  1019. |----------------------------------------------------------------------------}
  1020.  
  1021. Procedure FossilObject.ReadPicture(Var Line : String;Picture : String);
  1022.  
  1023. Const PicSet = ['U','L','X','N','S','Z'];
  1024.  
  1025. Var StrPtr : Byte;
  1026.     Key    : Char;
  1027.  
  1028. Begin
  1029. For StrPtr := 1 To Length(Picture) Do
  1030.  If Upcase(Picture[StrPtr]) In PicSet
  1031.     Then WriteF('_')
  1032.     Else WriteF(Picture[StrPtr]);
  1033. For StrPtr := 1 To Length(Picture) Do
  1034.     Write(#8);
  1035.  
  1036. Line:=Picture;
  1037. StrPtr:=1;
  1038. While StrPtr<=Length(Picture) Do
  1039.  Begin
  1040.  Case Upcase(Picture[StrPtr]) Of
  1041.   'N',
  1042.   'Z' : Begin
  1043.         Repeat
  1044.          Key:=ReadKeyF;
  1045.         Until (Key In ['0'..'9',#8]) Or Emergency;
  1046.  
  1047.         If Key<>#8
  1048.            Then Begin
  1049.                 WriteF(Key);
  1050.                 Line[StrPtr]:=Key;
  1051.                 Inc(StrPtr);
  1052.                 End
  1053.            Else Begin
  1054.                 If StrPtr>1
  1055.                    Then Begin
  1056.                         Repeat
  1057.                          Dec(StrPtr);
  1058.                          WriteF(Key);
  1059.                         Until (Picture[StrPtr] In PicSet) Or
  1060.                               (StrPtr=1);
  1061.                         End;
  1062.                 End;
  1063.         End;
  1064.   'U',
  1065.   'L',
  1066.   'X' : Begin
  1067.         Repeat
  1068.          Key:=ReadKeyF;
  1069.         Until (Upcase(Key) In ['A'..'Z',#8]) Or Emergency;
  1070.         If Key<>#8
  1071.            Then Begin
  1072.                 Case Upcase(Picture[StrPtr]) Of
  1073.                  'U' : Key:=Upcase(Key);
  1074.                  'L' : Key:=CHR(Byte(Key) OR $20);
  1075.                 End;
  1076.                 Line[StrPtr]:=Key;
  1077.                 WriteF(Key);
  1078.                 Inc(StrPtr);
  1079.                 End
  1080.            Else Begin
  1081.                 If StrPtr>1
  1082.                    Then Begin
  1083.                         Repeat
  1084.                          Dec(StrPtr);
  1085.                          WriteF(Key);
  1086.                         Until (Picture[StrPtr] In PicSet) Or
  1087.                               (StrPtr=1);
  1088.                         End;
  1089.                 End;
  1090.         End;
  1091.   'S' : Begin
  1092.         Repeat
  1093.          Key:=ReadKeyF;
  1094.         Until (Upcase(Key) In ['+','-',' ',#8]) Or Emergency;
  1095.         If Key<>#8
  1096.            Then Begin
  1097.                 If Key=' '
  1098.                    Then Key:='+';
  1099.                 WriteF(Key);
  1100.                 Line[StrPtr]:=Key;
  1101.                 Inc(StrPtr);
  1102.                 End
  1103.            Else Begin
  1104.                 If StrPtr>1
  1105.                    Then Begin
  1106.                         Repeat
  1107.                          Dec(StrPtr);
  1108.                          WriteF(Key);
  1109.                         Until (Picture[StrPtr] In PicSet) Or
  1110.                               (StrPtr=1);
  1111.                         End;
  1112.                 End;
  1113.         End;
  1114.   Else  Begin
  1115.         WriteF(Picture[StrPtr]);
  1116.         Inc(StrPtr);
  1117.         End;
  1118.  End; {Case}
  1119.  End;
  1120.  
  1121. For StrPtr := 1 To Length(Picture) Do
  1122.   If (Upcase(Picture[StrPtr])='Z') And
  1123.      (Line[StrPtr]='0')
  1124.      Then Line[StrPtr]:=' ';
  1125. End;
  1126.  
  1127.  
  1128.  
  1129. {----------------------------------------------------------------------------|
  1130.  Put's the PressEnterOrStopString on screen and waits for the user to press
  1131.  one of both keys.
  1132. |----------------------------------------------------------------------------}
  1133.  
  1134. Function FossilObject.PressEnterOrStop;
  1135. Var Dum : Char;
  1136. Begin
  1137. WriteF(PressEnterOrStopString);
  1138. Dum:=UpCase(AskKey(#13+UsedStopKey,UsedStopKey));
  1139. PressEnterOrStop:=Dum=UsedStopKey;
  1140. End;
  1141.  
  1142. {----------------------------------------------------------------------------|
  1143.  Put's the PressEnterString on screen and waits for the user to press
  1144.  a CarriageReturn
  1145. |----------------------------------------------------------------------------}
  1146.  
  1147. Procedure FossilObject.PressEnter;
  1148. Var Dum : Char;
  1149. Begin
  1150. WriteF(PressEnterString);
  1151. Dum:=AskKey(#13,#13);
  1152. End;
  1153.  
  1154. {----------------------------------------------------------------------------|
  1155.  Simply wait for ANY key (except #FF, result of a sysops key) to be pressed.
  1156. |----------------------------------------------------------------------------}
  1157.  
  1158. Procedure FossilObject.PressANYKey;
  1159. Var Dum : Char;
  1160. Begin
  1161. Repeat
  1162.  While Not KeyPressedF Do;
  1163.  Dum:=ReadKeyF;
  1164. Until (Dum<>#$FF) Or Emergency; { SysopKeys return #$FF! }
  1165. End;
  1166.  
  1167. {----------------------------------------------------------------------------|
  1168.  Clear the screen according to the UseGraphics and UseAvatar settings. If
  1169.  the user doesn't has the UseClr toggle set, only a NewLine is send.
  1170. |----------------------------------------------------------------------------}
  1171.  
  1172. Procedure FossilObject.ClrScrF;
  1173. Begin
  1174. If Not GlobalInfo.UseClrScr
  1175.    Then Begin
  1176.         WriteF(#13#10);
  1177.         Exit;
  1178.         End;
  1179. If GlobalInfo.UseGraphics And
  1180.    (Not GlobalInfo.UseAVATAR)
  1181.    Then WriteF(#27'[2J')
  1182.    Else WriteF(#12);
  1183. End;
  1184.  
  1185. {----------------------------------------------------------------------------|
  1186.  Put the cursor on a given place on the screen. Only works if ANSI or AVATAR
  1187.  is selected!
  1188. |----------------------------------------------------------------------------}
  1189.  
  1190.  
  1191. Procedure FossilObject.GotoXyF(X,Y : Byte);
  1192. Begin
  1193. If Not (GlobalInfo.UseGraphics Or GlobalInfo.UseAvatar)
  1194.    Then Exit;
  1195. If GlobalInfo.UseAVATAR
  1196.    Then WriteF(^V^H+Chr(Y)+Chr(X))
  1197.    Else WriteF(#27'['+S(Y,0)+';'+S(X,0)+'f');
  1198. End;
  1199.  
  1200.  
  1201. {----------------------------------------------------------------------------|
  1202.   The output filter procodures. MemFilterPtr is used to store the old
  1203.   outputfilter when OutputFilterOff is selected. It's restored when calling
  1204.   OutputFilterON.
  1205. |----------------------------------------------------------------------------}
  1206.  
  1207. Var MemFilterPtr : OutputFilterType;
  1208.  
  1209. Procedure FossilObject.InitOutputFilter(Filter : OutputFilterType);
  1210. Begin
  1211. OutputFilter:=Filter;
  1212. End;
  1213.  
  1214. Procedure FossilObject.OutputFilterOff;
  1215. Begin
  1216. MemFilterPtr:=OutputFilter;
  1217. OutputFilter:=NoFilter;
  1218. End;
  1219.  
  1220. Procedure FossilObject.OutputFilterOn;
  1221. Begin
  1222. OutputFilter:=MemFilterPtr;
  1223. End;
  1224.  
  1225.  
  1226. {----------------------------------------------------------------------------|
  1227.   The InitSysopKeys procedure, simple hooks your procedure to the SysOpkey
  1228.   handle.
  1229. |----------------------------------------------------------------------------}
  1230.  
  1231. Procedure FossilObject.InitSysopKeys(Keys : SysopKeyType);
  1232. Begin
  1233. SysopKeys:=Keys;
  1234. End;
  1235.  
  1236. {----------------------------------------------------------------------------|
  1237.   The InitStatLine procedure, simple hooks your procedure to the StatLine
  1238.   handle.
  1239. |----------------------------------------------------------------------------}
  1240.  
  1241. Procedure FossilObject.InitStatLine(Stat : StatLineType);
  1242. Begin
  1243. StatusLine:=Stat;
  1244. End;
  1245.  
  1246. {----------------------------------------------------------------------------|
  1247.   The InitInputFilter procedure, Copies your CharSet to the Used CharSet.
  1248. |----------------------------------------------------------------------------}
  1249.  
  1250. Procedure FossilObject.InitInputFilter(CharSet : InpFilterType);
  1251. Begin
  1252. InputFilter:=CharSet;
  1253. End;
  1254.  
  1255. {----------------------------------------------------------------------------|
  1256.  Write a single line after applying the Output filter. If the outputbuffer
  1257.  doesn't accept characters, TimeSlices are given back to Desqview.
  1258.  It also checks the carrier, but NOT the TimeOut logic!
  1259. |----------------------------------------------------------------------------}
  1260.  
  1261. Procedure FossilObject.WriteF(S : String);
  1262. Var Count : Byte;
  1263.     Regs  : Registers;
  1264. Begin
  1265.  
  1266. OutputFilter(S);
  1267.  
  1268. Count:=1;
  1269. While (Not Emergency) And (Count<=Length(S)) Do
  1270.  Begin
  1271.  If (BaudRate>0) And RemoteEcho
  1272.     Then Begin
  1273.          Repeat
  1274.           With Regs Do
  1275.            Begin
  1276.            AH:=$0B;
  1277.            AL:=Ord(S[Count]);
  1278.            DX:=Port;
  1279.            End;
  1280.           Intr($14,Regs);
  1281.  
  1282.          {$IfDef MakeDVAwear}
  1283.          If Regs.AX<>$0001
  1284.             Then DV_Pause;
  1285.          {$EndIf}
  1286.  
  1287.          Until (Regs.AX=$0001)
  1288.                {$IfDef CheckCarrier}
  1289.                  Or (Not Carrier)
  1290.                {$EndIf} ;
  1291.          End;
  1292.  
  1293.  If LocalEcho
  1294.     Then {$IfDef UseDRIVERUnit}
  1295.          ScreenDriver(S[Count]);
  1296.          {$Else}
  1297.          Write(ANSI,S[Count]);
  1298.          {$EndIf}
  1299.  
  1300.  Inc(Count);
  1301.  
  1302.  {$IfDef CheckCarrier}
  1303.    Emergency:= Not Carrier;
  1304.  {$EndIf}
  1305.  End;
  1306. End;
  1307.  
  1308. {----------------------------------------------------------------------------|
  1309.   Simply add a NewLine to the String and pass it to WriteF
  1310. |----------------------------------------------------------------------------}
  1311.  
  1312.  
  1313. Procedure FossilObject.WriteLnF(S : String);
  1314. Begin
  1315. WriteF(S);
  1316. WriteF(#13#10);
  1317. End;
  1318.  
  1319. {----------------------------------------------------------------------------|
  1320.   Clear the input/output buffers.
  1321. |----------------------------------------------------------------------------}
  1322.  
  1323. Procedure FossilObject.ClearInput;
  1324. Var Regs : Registers;
  1325. Begin
  1326. If BaudRate=0
  1327.    Then Exit;
  1328. Regs.DX:=Port;
  1329. Regs.AH:=$0A;
  1330. Intr($14,Regs);
  1331. End;
  1332.  
  1333. Procedure FossilObject.ClearOutput;
  1334. Var Regs : Registers;
  1335. Begin
  1336. If BaudRate=0
  1337.    Then Exit;
  1338. Regs.AH:=$09;
  1339. Regs.DX:=Port;
  1340. Intr($14,Regs);
  1341. End;
  1342.  
  1343. {----------------------------------------------------------------------------|
  1344.  Detect if the other side is capable of ansi.
  1345. |----------------------------------------------------------------------------}
  1346.  
  1347. {$IfDef UseDRIVERunit}
  1348.  
  1349. Function FossilObject.DetectAnsi:Boolean;
  1350. Var AnsiTimeOut  : TimerObject;
  1351. Begin
  1352. If BaudRate=0
  1353.    Then Begin
  1354.         DetectAnsi:=True;
  1355.         Exit;
  1356.         End;
  1357.  
  1358. OutputFilterOFF;
  1359. WriteF(#27'[6n'); { Ask for cursor possition }
  1360. RemoteEcho:=False;
  1361. AnsiTimeOut.SetTimer(30); { Take 3 seconds for detection }
  1362. Repeat
  1363.  If KeyPressedF
  1364.     Then WriteF(ReadKeyF);
  1365. Until Driver.AnsiDetect or AnsiTimeOut.TimeUp or Emergency;
  1366. RemoteEcho:=True;
  1367. DetectAnsi:=Driver.AnsiDetect;
  1368. OutputFilterOn;
  1369. End;
  1370.  
  1371. {$EndIf}
  1372.  
  1373. {----------------------------------------------------------------------------|
  1374.   Some things have to be initialized. So here it's done
  1375. |----------------------------------------------------------------------------}
  1376.  
  1377. Begin
  1378. MemFilterPtr:=NoFilter;
  1379. {$IFDef MakeDVAwear}
  1380.   GlobalInfo.Desqview:=DVUsed;
  1381. {$Else}
  1382.   GlobalInfo.DesqView:=False;
  1383. {$EndIf}
  1384. {$IfDef CheckTimeOut}
  1385.  MinuteTick.SetTimer(600);
  1386. {$EndIf}
  1387. End.
  1388. {----------------------------------------------------------------------------|
  1389.    Finto.. Baste.. Het Einde.. The End.
  1390. |----------------------------------------------------------------------------}
  1391.