home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / opus / opin103d.lzh / DEMO_COM.PAS < prev    next >
Pascal/Delphi Source File  |  1989-12-03  |  4KB  |  102 lines

  1. Program Demo_Com;
  2.  
  3.   {***************************************************************************}
  4.   {*                                                                         *}
  5.   {* O p u s   I n t e r f a c e    V e r   1.03     Demo Program.           *}
  6.   {*                                                                         *}
  7.   {*   Opus V 1.0x Interface for Turbo Pascal Ver 4.0, 5.0 and 5.5           *}
  8.   {*                                                                         *}
  9.   {*  These Structures,Procedures and Functions may help you to make OPUS    *}
  10.   {* utilities for to help other SysOps, Please read the Documentation.      *}
  11.   {*                                                                         *}
  12.   {*  Regards                                                                *}
  13.   {*    Per Holm                                                             *}
  14.   {*                                                                         *}
  15.   {*   FIDO: Per Holm - Asgaard BBS 2:230/22.0                               *}
  16.   {*   UUCP: perholm@daimi.DK                                                *}
  17.   {*                                                                         *}
  18.   {***************************************************************************}
  19.  
  20.   {***************************************************************************}
  21.   {*                                                                         *}
  22.   {*  Demo of some level 1 and 2 level communications routines..             *}
  23.   {*                                                                         *}
  24.   {***************************************************************************}
  25.  
  26. {$I-}
  27.  
  28. Uses OPINT,Crt,Dos;
  29.  
  30. VAR
  31.   c:char;
  32.   i: Integer;
  33.   ComIn,ComOut: Text;
  34.   Line: String[80];
  35.  
  36. BEGIN
  37.   _Snoop:=_On;                                 { Look at this...              }
  38.   _KeyBoard:=_On;                              { Enable Keyboard              }
  39.   _ExitCarrier:=0;                             { Don't exit on Carrier change }
  40.   AssignFossil(ComIn,0,0);                     { Assign for input Don;t       }
  41.   i:=OpIntError;
  42.   IF (i<>0) and (i<>191) THEN
  43.     BEGIN
  44.       writeln(#7,'Error initialising the FOSSIL');
  45.       Halt(9);
  46.     END;
  47.   IF i=191 THEN
  48.     SetDtrFossil(ComIn,_Off);
  49.   Reset(ComIn);                                { change BaudRate              }
  50.   IF IOResult<>0 THEN
  51.     BEGIN
  52.       writeln(#7,'Error initialising the FOSSIL');
  53.       Halt(9);
  54.     END;
  55.   AssignFossil(ComOut,0,0);                    { Here's a device to write to  }
  56.   i:=OpIntError;
  57.   IF (i<>0) and (i<>191) THEN
  58.     BEGIN
  59.       i:=OpIntError;
  60.       writeln(#7,'Error initialising the FOSSIL');
  61.       Halt(9);
  62.     END;
  63.   IF i=191 THEN
  64.     SetDtrFossil(ComOut,_Off);
  65.   SetAnsiFossil(ComOut,(Usr.Flags AND Usr_Ansi>0));
  66.   rewrite(ComOut);
  67.   IF IOResult<>0 THEN
  68.     BEGIN
  69.       writeln(#7,'Error initialising the FOSSIL');
  70.       Halt(9);
  71.     END;
  72.   WriteLn(ComOut,'Hi Johnny, Enter a line of text');
  73.   Readln(ComIn,Line);
  74.   IF IOResult<>0 THEN
  75.     BEGIN
  76.       writeln(#7,'Error reading from the FOSSIL');
  77.       Halt(9);
  78.     END;
  79.   Writeln(ComOut,'OK here we go : "',Line,'"');
  80.   IF IOResult<>0 THEN
  81.     BEGIN
  82.       writeln(#7,'Error writing to the FOSSIL');
  83.       Halt(9);
  84.     END;
  85.   IF FossilCarrier(ComIn) THEN
  86.     Writeln('Carrier OK');
  87.   write(ComOut,'Thanx Press Enter');
  88.   IF IOResult<>0 THEN
  89.     BEGIN
  90.       writeln(#7,'Error writing to the FOSSIL');
  91.       Halt(9);
  92.     END;
  93.   repeat
  94.   until ReadFossil(ComIn)=#13;
  95.   writeln(ComOut);
  96.   IF IOResult<>0 THEN
  97.     BEGIN
  98.       writeln(#7,'Error writing to the FOSSIL');
  99.       Halt(9);
  100.     END;
  101. END.
  102.