{
 ßßßßßßßß  ßßßßßß    ßß   ßß
   ßß     ßß   ßß   ßß  ßß
  ßß     ßß   ßßß  ßßßßß  The DoorKit!
 ßß     ßß   ßß   ßß  ßß
ßß     ßßßßßß    ßß    ßß
The BBS Door Development Kit By The People - For The People!


   Feel free to modify or optimize this code at will. All I ask is that if
   find a better way to do things (and you will), please send me a copy of
   your modifications. Thanks in advance!....Larry L. Athey....

   This is the variable/constant declaration unit.}

{$A+,B-,D+,E+,F+,G+,I-,L+,N-,O+,P-,Q-,R-,S-,T-,V+,X+}
UNIT TDK_VARS;

INTERFACE

USES DOS;

TYPE ControlFile  = RECORD     {Record of settings for each node}
     Month        : WORD;      {The Month, Day, Year variables may be used at}
     Day          : WORD;      {the programmers discretion. I use them in}
     Year         : WORD;      {some doors to keep track of maintenance}
     SFirst       : STRING[20];{Sysop first name}
     SLast        : STRING[20];{Sysop last name}
     SysSec       : WORD;      {Sysop security level on the BBS}
     BBSname      : STRING[40];{The name of the BBS}
     SerialNumber : STRING[10];{Use this if you issue serial numbers}
     HomePath     : STRING[12];{BBS software home path, I use it for Shotgun}
     UseFossil    : BOOLEAN;   {Use FOSSIL comm routines Yes/No}
     PortSpeed    : LONGINT;   {Locked port speed (38000 max for FOSSIL)}
     UseDigi      : BOOLEAN;   {Use DigiBoard comm routines? Yes/No}
     WordSize     : BYTE;      {Data Bits (Normally set to 8)}
     Parity       : CHAR;      {Parity O]dd E]ven N]one (Normally set to N)}
     StopBits     : BYTE;      {Stop Bits (Normally set to 1)}
     InBuffer     : WORD;      {Input buffer size (Default 512)}
     OutBuffer    : WORD;      {Output buffer size (Default 1024)}
     NSP          : BOOLEAN;   {Non-Standard port settings Yes/No}
     Port         : BYTE;      {Comport number}
     IRQ          : BYTE;      {Comport IRQ}
     HexAddr      : STRING[4]; {Comport Hex address}
     END;

    {NOTE: Not all settings in the control files are required. They are just
           there in case you find a need for them. Adjust as needed....}

TYPE ColorScheme = RECORD    {Record of system colors, expand this at will.}
     Hfg,                    {Window header foreground}
     Hbg,                    {Window header background}
     Wbg,                    {Window background}
     Sfg,                    {Window shadow foreground}
     Sbg,                    {Window shadow background}
     Wh,                     {Window highlight color}
     Wl,                     {Window lowlight color}
     Ffg,                    {Input field text foreground}
     Fbg,                    {Input field text background}
     Bfg,                    {Input field bracket foreground}
     CPBfg,                  {CPrompt bracket foreground}
     CPBbg,                  {CPrompt bracket background}
     CPKfg,                  {CPrompt hotkey foreground}
     CPKbg,                  {CPrompt hotkey background}
     CPTfg,                  {CPrompt text foreground}
     CPTbg,                  {CPrompt text background}
     TxFG,                   {Text reader foreground}
     TxBG : BYTE;            {Text reader background}
     END;

TYPE tScreen    = ARRAY[0..24,0..159] OF BYTE;
     tSystemEnv = (NoTasker,DDOS,DV,WIN,OS2,Network);
     tWhichIO   = (FossilIO,InternalIO,DigiIO);
    {------------------------------------------------------------------------}
    tDoor       = RECORD     {Record for the Door-System variables}
    UserName    : STRING[40];{User's real name}
    Alias       : STRING[40];{User's alias name}
    PassWord    : STRING[40];{User's password}
    UserCity    : STRING[40];{User's location}
    Phone       : STRING[15];{User's home/voice phone number}
    WorkPhone   : STRING[15];{User's work/data phone number}
    BBSname     : STRING[40];{The name of the BBS}
    Access      : WORD;      {User's security level}
    UserNumber  : WORD;      {User's record number}
    Event       : INTEGER;   {Minutes until next event}
    {------------------------------------------------------------------------}
    Comport     : BYTE;      {Which Comport the program is using; 0=local}
    BaudRate    : LONGINT;   {Baudrate for the comport}
    WhichIO     : tWhichIO;  {Which IO routines to use (fossil or internal)}
    IOinstalled : BOOLEAN;   {Comport IO routines installed?}
    InBufSize   : WORD;      {Input buf size. (only for internal routines)}
    OutBufSize  : WORD;      {Output buf size. (only for internal routines)}
    IRQ         : BYTE;      {Which IRQ is being used}
    WordSize    : BYTE;      {Wordsize (Data Bits) for comport}
    Parity      : CHAR;      {Parity for comport; 'N'=none 'E'=even 'O'=odd}
    StopBits    : BYTE;      {Stop Bits for comport}
    Node        : BYTE;      {Which node the user is on}
    {------------------------------------------------------------------------}
    LocalInputON: BOOLEAN;   {Enable/Disable local keyboard input}
    UpdateLocal : BOOLEAN;   {Writes to the local screen are allowed or not?}
{*} UpdateStatusBar: BOOLEAN;{Update status bar? (even if updatelocal=false)}
{*} UseVirtScr  : BOOLEAN;   {Use the virtual screen?}
{*} StatusBarY  : BYTE;      {What line the status bar is displayed on}
{*} LocalMaxY   : BYTE;      {# of lines (1-#) to update on local screen (usually 25)}
    {------------------------------------------------------------------------}
    SecondsLeft : LONGINT;   {Seconds Left until user is booted back to BBS}
    MinutesLeft : LONGINT;   {Minutes Left until user is booted back to BBS}
{*} IdleCount   : INTEGER;   {How many seconds the user has been inactive}
    UpdateSecs  : BOOLEAN;   {Update the user's remaining time?}
    UpdateIdle  : BOOLEAN;   {Ckeck for user inactivity?}
{*} LocalKey    : BOOLEAN;   {Was the last key pressed local?}
{*} OnLine      : BOOLEAN;   {Is user online/connected?}
    {------------------------------------------------------------------------}
    END;

{*  Variables marked with an asterisk are "Read-Only" and should never be
    modified or altered by your code. AGAIN! - DO NOT TAMPER WITH THESE!}

CONST
  VirtScr        : ^tScreen = NIL; {Virtual Screen Record}
  VirtX          : INTEGER = 1;    {Virtual X cursor position}
  VirtY          : INTEGER = 1;    {Virtual Y cursor position}
  WrapInput      : BOOLEAN = FALSE;{Word wrap input fields Y/N?}
  Local          : BOOLEAN = TRUE; {Are we running in local mode?}
  Tty            = 0;
  Ansi           = 1;
  Avatar         = 2;
  Rip            = 3;
  Max            = 4;
  Graphics       : BYTE    = Ansi; {Remote caller's graphics protocol}
  InChat         : BOOLEAN = FALSE;{Are we currently in SysOp <> User Chat?}
  SGT            : BOOLEAN = FALSE;{Is the remote running Shotgun SGT?}
  UseSVGA        : BOOLEAN = FALSE;{Allow the use of SVGA graphics?}
  LocalSVGA      : BOOLEAN = FALSE;{Activate local SVGA graphics?}
  UseDoorSys     : BOOLEAN = TRUE; {Allow door to read DOOR.SYS?}
  UseDorInfo     : BOOLEAN = TRUE; {Allow door to read DORINFO#.DEF?}
  UseMxUser      : BOOLEAN = TRUE; {Allow door to read MX_USER.DAT?}
  _HangUp        : BOOLEAN = FALSE;{Lower DTR before terminating?}
  HideParams     : BOOLEAN = FALSE;{Hide information when exiting door?}
  UseTTY         : BOOLEAN = FALSE;{Allow ASCII/TTY callers in the door?}
  KillDrop       : BOOLEAN = FALSE;{Delete drop file before terminating?}
  Shotgun        : BOOLEAN = FALSE;{Is this a Shotgun BBS system?}
  IntConfig      : BOOLEAN = FALSE;{Use internal configuration program?}
  UseLocal       : BOOLEAN = TRUE; {Allow local operation of the door?}
  UseLog         : BOOLEAN = FALSE;{Use activity logging?}
  UseAd          : BOOLEAN = TRUE; {Display program ad upon startup?}
  SvgaActive     : BOOLEAN = FALSE;{Is the local SVGA display active?}
  SvgaAnsiOn     : BOOLEAN = FALSE;{Is the local SVGA ANSI display active?}
  ShowLog        : BOOLEAN = FALSE;{Write activity logging to the screen? [Y/N]}
  Wraplength     : BYTE = 78;      {The maximum word length for input driver.}
  DVseg          : WORD = $B800;   {B800=Color, B000=Mono}
  DVofs          : WORD = $0000;   {The OFS is needed in case I/You create routines
                                    that will write to a virtual page, virtual pages
                                    will not always start at 0000. For more exaples
                                    of writing to virtual pages see ANSIUNIT.PAS}

TYPE CursorMoveType = RECORD
  Up     : ARRAY[Tty..Avatar] OF STRING[3];
  Down   : ARRAY[Tty..Avatar] OF STRING[3];
  Right  : ARRAY[Tty..Avatar] OF STRING[3];
  Left   : ARRAY[Tty..Avatar] OF STRING[3];
  Home   : ARRAY[Tty..Avatar] OF STRING[3];
  Endkey : ARRAY[Tty..Avatar] OF STRING[3];
  Insert : ARRAY[Tty..Avatar] OF STRING[3];
  Delete : ARRAY[Tty..Avatar] OF STRING[3];
END;

CONST
  CursorMove : CursorMoveType = (Up     : (#0+#72,#27'[A',#22+#3);
                                 Down   : (#0+#80,#27'[B',#22+#4);
                                 Right  : (#0+#77,#27'[C',#22+#6);
                                 Left   : (#0+#75,#27'[D',#22+#5);
                                 Home   : (#0+#71,#27'[H',#22+#0);
                                 EndKey : (#0+#79,#27'[K',#22+#0);
                                 Insert : (#0+#82,#22,#22);
                                 Delete : (#0+#83,#127,#127));

VAR
  CurTime       : DATETIME;   {The Current Time}
  DropFilePath  : STRING[80]; {Path to drop files}
  Ctl           : ControlFile;{Record for storing door setups per node}
  CS            : ColorScheme;{Record for storing various system colors}
  DoorSys       : tDoor;      {Door-System record}
  StartTime     : DATETIME;   {What time the user entered door}
  SystemEnv     : tSystemEnv; {What OS is operating locally?}
  BackSpaceChar : CHAR;       {Character to use when the BS key is pressed}
  LengthScr     : BYTE;       {Length of the remote caller's screen}
  CurColor      : BYTE;       {Stores the last text attribute value.}
  FossilName    : STRING;     {ID name of the Fossil / DigiBoard}
  LogPath       : STRING[80]; {Path to write activity log file}
  LogFile       : STRING[40]; {Activity log file name (Room for variables)}
  UFirst        : STRING[20]; {User's first name}
  ULast         : STRING[20]; {User's last name}
  Insert1       : STRING[20];
  Insert2       : STRING[20];
  Insert3       : STRING[20];
  Insert4       : STRING[20];
  Insert5       : STRING[20]; {Various "Dynamic" global system variables}
  s_ReadKey     : STRING[2];  {Local storage for sReadKey extended keys}
  MaxID         : STRING[4];  {Version of MAX Graphics the caller supports}
  ProgramName   : STRING[80]; {Name and version of the current program}
  ProgramDesc   : STRING[80]; {Description of the current program}
  ErrLevel      : BYTE;       {Errorlevel to exit the program with}

  ClockResult   : LONGINT;    {These are for time keeping purposes only}
  StopClock     : LONGINT;    {Do not mess with these or you could lock}
  StartClock    : LONGINT;    {up your program....}

IMPLEMENTATION

END.
