home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / PIBTERM.ZIP / PIBDUMBT.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1987-11-25  |  4.8 KB  |  100 lines

  1. (*----------------------------------------------------------------------*)
  2. (*          DUMBTERM.PAS --- Emulate Dumb Terminal for PIBTERM          *)
  3. (*----------------------------------------------------------------------*)
  4. (*                                                                      *)
  5. (*  Author:  Philip R. Burns                                            *)
  6. (*  Date:    January, 1985                                              *)
  7. (*  Version: 1.0                                                        *)
  8. (*  Systems: For MS-DOS on IBM PCs and close compatibles only.          *)
  9. (*           Note:  I have checked these on Zenith 151s under           *)
  10. (*                  MSDOS 2.1 and IBM PCs under PCDOS 2.0.              *)
  11. (*                                                                      *)
  12. (*  Needs:   The Menu routines from MENUS.PAS, communications routines  *)
  13. (*           from ASYNC.PAS, and various global variables from          *)
  14. (*           PIBTERM.PAS.                                               *)
  15. (*                                                                      *)
  16. (*  History: Original with me.                                          *)
  17. (*                                                                      *)
  18. (*           Suggestions for improvements or corrections are welcome.   *)
  19. (*           Please leave messages on Gene Plantz's BBS (312) 882 4145  *)
  20. (*           or Ron Fox's BBS (312) 940 6496.                           *)
  21. (*                                                                      *)
  22. (*           If you use this code in your own programs, please be nice  *)
  23. (*           and give proper credit.                                    *)
  24. (*                                                                      *)
  25. (*----------------------------------------------------------------------*)
  26.  
  27. Procedure Emulate_Dumb_Terminal;
  28.  
  29. (*                                                                      *)
  30. (*     Procedure:  Emulate_Dumb_Terminal                                *)
  31. (*                                                                      *)
  32. (*     Purpose:    Controls dumb terminal emulation                     *)
  33. (*                                                                      *)
  34. (*     Calling Sequence:                                                *)
  35. (*                                                                      *)
  36. (*        Emulate_Dumb_Terminal;                                        *)
  37. (*                                                                      *)
  38. (*      Calls:   Async_Send                                             *)
  39. (*               Async_Receive                                          *)
  40. (*               KeyPressed                                             *)
  41. (*               Process_Command                                        *)
  42. (*               Display_Character                                      *)
  43. (*               ClrScr                                                 *)
  44. (*                                                                      *)
  45. (*      Remarks:                                                        *)
  46. (*                                                                      *)
  47. (*         You can replace this with something smarter --- i.e.,        *)
  48. (*         a VT100 emulator, or whatever you like.                      *)
  49. (*                                                                      *)
  50.  
  51. Var
  52.    Done: Boolean           (* TRUE to exit terminal emulation mode *);
  53.    Ch  : Char              (* Character read/written               *);
  54.  
  55. Begin (* Emulate_Dumb_Terminal *)
  56.  
  57.    ClrScr;
  58.    Writeln('Beginning Dumb Terminal Emulation');
  59.  
  60.    Done := FALSE;
  61.                                    (* Loop over input until done *)
  62.    While ( NOT Done ) DO
  63.       Begin
  64.  
  65.          If KeyPressed Then
  66.             Begin
  67.                Read( Kbd , Ch );
  68.  
  69.                Case ORD( Ch ) Of
  70.  
  71.                   ESC:  Process_Command( Done, Ch, FALSE );
  72.  
  73.                   BS:   Begin
  74.                            Ch := BS_Char;
  75.                            If Local_Echo Then Write( Ch );
  76.                            Async_Send( Ch );
  77.                         End;
  78.  
  79.                   DEL:  Begin
  80.                            Ch := Ctrl_BS_Char;
  81.                            If Local_Echo Then Write( Ch );
  82.                            Async_Send( Ch );
  83.                         End;
  84.  
  85.                   Else
  86.                         Begin
  87.                            If Local_Echo Then Write( Ch );
  88.                            Async_Send( Ch );
  89.                         End;
  90.  
  91.                End (* CASE ORD( Ch ) *);
  92.  
  93.             End;
  94.  
  95.          If Async_Receive( Ch ) Then Display_Character( Ch );
  96.  
  97.       End;
  98.  
  99. End   (* Emulate_Dumb_Terminal *);
  100.