program example;

{****************************************************************************
 *                                                                          *
 *  This is a very basic program that will show you a few of the VERY many  *
 *  functions available to the programmer using the TriDoor package.        *
 *                                                                          *
 *  To most effectively use and understand the unit, you should invest the  *
 *  time to read the manual included in the release and then experiment     *
 *  with the unit in your own programs.                                     *
 *                                                                          *
 ****************************************************************************}

uses
  crt,
  tridr55u;            { The TriDoor unit must come after the CRT unit. }

{* * * * * * * *}

procedure example_getinput;

{* This procedure will show some of the getinput() function capabilities
   and features.                                                          *}

var
  tempin : string;   {* input string used for this procedure *}

begin {* example_getinput *}

  clearcom;

  print('This is an example of some of TriDoor''s input features.  All these||');
  print('capabilities are built in and very easy to use.||');
  print('-------------------------------------------------------------------||||');
  
  print('  This is an example of standard input -||');
  print('  What do you think of TriDoor?||');
  print('  -> ');
  tempin := getinput(80);
  print('||||||');

  print('  This is an example of limited input -||');
  print('  Enter your name (10 Characters Max) : ');
  tempin := getinput(10);
  print('||||||');

  print('  This is an example of coded and limited input -||');
  print('  Enter your password (12 Characters Max ) : ');
  code := true;
  tempin := getinput(12);
  print('  You entered the password : '+tempin+'.||||||');

  print('  This is an example of limited and upper-cased input -||');
  print('                                   [------------]||');
  print('  Enter name of file to download :  ');
  caps := true;
  tempin := getinput(12);
  print('||||||');

  print('Press any key to continue : ');
  tempin[1] := getkey;

end;  {* example_getinput *}

{* * * * * * * *}

procedure example_ANSI;

{* This is an example of some ANSI screen controls that are built right
   into the TriDoor program.  These screen controls were used to make
   TriUser- a QuickBBS On-Line ANSI Utilizing User Editor.               *}

var
  tempin : string;   {* input string used for this procedure *}

begin {* example_ANSI *}

  clearcom;

  ancolor(0,INTENSITY,BLUE,BLACK);
  print('This ');
  ancolor(0,INTENSITY,YELLOW,BLACK);
  print('is ');
  ancolor(0,INTENSITY,GREEN,BLACK);
  print('an ');
  ancolor(0,INTENSITY,MAGENTA,BLACK);
  print('example ');
  ancolor(0,0,CYAN,BLACK);
  print('of ');
  ancolor(0,0,RED,BLACK);
  print('ANSI');
  ancolor(BLINK,INTENSITY,CYAN,BLACK);
  print('!');

  angotoxy(10,10);
  ancolor(BLINK,INTENSITY,CYAN,BLUE);
  print('ANSI CONTROLS CAN BE FUN!!!');

  angotoxy(1,20);
  ancolor(0,0,WHITE,BLACK);
  print('Press any key to continue : ');
  tempin[1] := getkey;

end;  {* example_ANSI *}

{* * * * * * * *}

procedure wrapup;

{* This is simply an ending procedure to the program. *}

begin {* wrapup *}

  clearcom;

  print('||||');
  print('      Well, that is about all  there is for  THIS particular  program BUT||');
  print('    as I pointed out earlier, the  possibilities are many  and due to the||');
  print('    very loose interface structure of the unit the limits are few.||||');
  
  print('      If you have any problems or questions, please feel free to call our||');
  print('    BBS or drop us a  letter at  the address listed in  the documentation||');
  print('    under the heading of "Who to Contact".||||');

  print('      We hope you find  TriDoor as useful, pliable and easy to use  as we||');
  print('    have.  Good luck and happy programming!||||||');

end;  {* wrapup *}

{* * * * * * * *}

begin {* main procedure *}

  clrscr;

  if ( readquick ) then      {* if DORINFO1.DEF exists (and was read)... *}
    begin

      if ( setuptri ) then
        begin

          example_getinput;
          example_ANSI;
          wrapup;

        end
      else writeln('Error : TriDoor was inable to set-up COMM port.',chr(7));

    end
  else writeln('Error : File DORINFO1.DEF not found.',chr(7));


end.  {* main procedure *}