home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / bbs / pibterm / pibt3sp2 / pibgossi.pas < prev    next >
Pascal/Delphi Source File  |  1985-10-04  |  6KB  |  160 lines

  1. (*--------------------------------------------------------------------------*)
  2. (*        Emulate_Gossip --- Gossip Mode from PibTerm to PibTerm            *)
  3. (*--------------------------------------------------------------------------*)
  4.  
  5. OVERLAY PROCEDURE Emulate_Gossip;
  6.  
  7. (*--------------------------------------------------------------------------*)
  8. (*                                                                          *)
  9. (*     Procedure:  Emulate_Gossip                                           *)
  10. (*                                                                          *)
  11. (*     Purpose:    Provides split-screen gossip mode, dumb terminal         *)
  12. (*                 emulation.                                               *)
  13. (*                                                                          *)
  14. (*     Calling sequence:                                                    *)
  15. (*                                                                          *)
  16. (*        Emulate_Gossip;                                                   *)
  17. (*                                                                          *)
  18. (*     Calls:                                                               *)
  19. (*                                                                          *)
  20. (*        Async_Receive                                                     *)
  21. (*        Process_Command                                                   *)
  22. (*        KeyPressed                                                        *)
  23. (*        Async_Send                                                        *)
  24. (*        Display_Character                                                 *)
  25. (*                                                                          *)
  26. (*     Called by:                                                           *)
  27. (*                                                                          *)
  28. (*        PibTerm (Main)                                                    *)
  29. (*                                                                          *)
  30. (*--------------------------------------------------------------------------*)
  31.  
  32. VAR
  33.    MyX:        INTEGER;
  34.    MyY:        INTEGER;
  35.    YourX:      INTEGER;
  36.    YourY:      INTEGER;
  37.    Save_Local: BOOLEAN;
  38.    I:          INTEGER;
  39.    Comm_Ch:    CHAR;
  40.    Done:       BOOLEAN;
  41.  
  42. BEGIN (* Emulate_Gossip *)
  43.                                    (* Turn on local echo, set initial *)
  44.                                    (* positions for each user's       *)
  45.                                    (* message area.                   *)
  46.    Save_Local     := Local_Echo;
  47.    Local_Echo     := TRUE;
  48.    MyX            := 1;
  49.    MyY            := 1;
  50.    YourX          := 1;
  51.    YourY          := 1;
  52.    Done           := FALSE;
  53.                                    (* Split screen into two parts:    *)
  54.                                    (* Upper for local user, lower for *)
  55.                                    (* remote user.                    *)
  56.    Window( 1, 1, 80, 25 );
  57.    ClrScr;
  58.  
  59.                                    (* Print divider                   *)
  60.    GoToXY( 1 , 13 );
  61.  
  62.    FOR I := 1 TO 25 DO WRITE('=');
  63.    WRITE('Enter ALT-G to exit chat mode');
  64.    FOR I := 1 TO 26 DO WRITE('=');
  65.  
  66.    REPEAT
  67.                                    (* Check comm buff overflow        *)
  68.       Async_Buffer_Full;
  69.                                    (* Process local user's input      *)
  70.       IF KeyPressed THEN
  71.          BEGIN
  72.  
  73.             Window( 1, 14, 80, 25 );
  74.             GoToXY( MyX, MyY );
  75.  
  76.             READ( Kbd , Comm_Ch );
  77.  
  78.             CASE ORD( Comm_Ch ) OF
  79.  
  80.                ESC:  IF KeyPressed THEN
  81.                         BEGIN
  82.                            Process_Command( Comm_Ch, FALSE, PibTerm_Command );
  83.                            IF PibTerm_Command <> Null_Command THEN
  84.                               Execute_Command( PibTerm_Command, Done, FALSE );
  85.                         END
  86.                      ELSE
  87.                         BEGIN
  88.                            IF Local_Echo THEN WRITE( Comm_Ch );
  89.                            Async_Send( Comm_Ch );
  90.                         END;
  91.  
  92.  
  93.                BS:   BEGIN
  94.                         Comm_Ch := BS_Char;
  95.                         IF Local_Echo THEN
  96.                            Display_Character( Comm_Ch );
  97.                         Async_Send( Comm_Ch );
  98.                      END;
  99.  
  100.                DEL:  BEGIN
  101.                         Comm_Ch := Ctrl_BS_Char;
  102.                         IF Local_Echo THEN
  103.                            Display_Character( Comm_Ch );
  104.                         Async_Send( Comm_Ch );
  105.                      END;
  106.  
  107.                CR:   BEGIN
  108.                         IF Local_Echo THEN WRITELN( Comm_Ch );
  109.                         Async_Send( Comm_Ch );
  110.                      END;
  111.  
  112.                ELSE
  113.                      BEGIN
  114.                         IF Local_Echo THEN
  115.                            Display_Character( Comm_Ch );
  116.                         Async_Send( Comm_Ch );
  117.                      END;
  118.  
  119.             END (* CASE ORD( Comm_Ch ) *);
  120.  
  121.                                    (* Remember position! *)
  122.             MyX := WhereX;
  123.             MyY := WhereY;
  124.  
  125.          END (* KeyPressed *);
  126.                                    (* Process script file entry *)
  127.  
  128.       IF ( Script_File_Mode AND ( NOT ( Done OR Really_Wait_String ) ) ) THEN
  129.          BEGIN
  130.             Get_Script_Command( PibTerm_Command );
  131.             Execute_Command   ( PibTerm_Command , Done , TRUE );
  132.          END;
  133.                                    (* Process remote user's input *)
  134.  
  135.       IF Async_Receive( Comm_Ch ) THEN
  136.  
  137.          BEGIN  (* Comm_Ch found *)
  138.                                    (* Check comm buff overflow        *)
  139.             Async_Buffer_Full;
  140.  
  141.             Window( 1, 1, 80, 12 );
  142.             GoToXY( YourX, YourY );
  143.  
  144.             Display_Character( TrTab[ Comm_Ch ] );
  145.  
  146.             YourX := WhereX;
  147.             YourY := WhereY;
  148.  
  149.          END (* Comm_Ch found *);
  150.  
  151.    UNTIL ( NOT Gossip_Mode_On ) OR Done;
  152.  
  153.                                   (* Restore single screen mode *)
  154.    Local_Echo          := Save_Local;
  155.  
  156.    Window( 1, 1, 80, 25 );
  157.    ClrScr;
  158.  
  159. END    (* Emulate_Gossip *);
  160. ə