home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / pibterm / pibt41s1.arc / EXECPC.MOD < prev    next >
Text File  |  1987-12-03  |  4KB  |  106 lines

  1. (*----------------------------------------------------------------------*)
  2. (*           Exec_PC_Commands  --- Process EXEC PC BBS commands         *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE Exec_PC_Commands;
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*     Procedure:  Exec_PC_Commands                                     *)
  10. (*                                                                      *)
  11. (*     Purpose:    Process Exec PC BBS special escape code commands     *)
  12. (*                                                                      *)
  13. (*     Calling Sequence:                                                *)
  14. (*                                                                      *)
  15. (*        Exec_PC_Commands;                                             *)
  16. (*                                                                      *)
  17. (*     Calls:                                                           *)
  18. (*                                                                      *)
  19. (*        Async_Send                                                    *)
  20. (*        Async_Receive                                                 *)
  21. (*        PibDownLoad                                                   *)
  22. (*                                                                      *)
  23. (*----------------------------------------------------------------------*)
  24.  
  25. VAR
  26.    X:      INTEGER;
  27.    Y:      INTEGER;
  28.    Ch:     CHAR;
  29.    L:      INTEGER;
  30.  
  31. (*----------------------------------------------------------------------*)
  32.  
  33. PROCEDURE Get_Async_Char;
  34.  
  35. VAR
  36.    C: INTEGER;
  37.  
  38. BEGIN (* Get_Async_Char *)
  39.  
  40.    Async_Receive_With_TimeOut( 5 , C );
  41.  
  42.    IF ( C = TimeOut ) THEN
  43.       Ch := #0
  44.    ELSE
  45.       Ch := CHR( C );
  46.  
  47. END   (* Get_Async_Char *);
  48.  
  49. (*----------------------------------------------------------------------*)
  50.  
  51. BEGIN (* Exec_PC_Commands *)
  52.  
  53.                                    (* Get next character after Exec PC flag *)
  54.    Get_Async_Char;
  55.                                    (* Handle it *)
  56.    CASE Ch OF
  57.  
  58.       'D' : BEGIN (* Auto-Download *)
  59.  
  60.                FileName := '';
  61.                L        := 0;
  62.  
  63.                WRITE('Autodownloading         ');
  64.  
  65.                REPEAT
  66.  
  67.                   Get_Async_Char;
  68.  
  69.                   IF NOT ( ORD( Ch ) IN [ACK,CAN,NUL] ) THEN
  70.                      BEGIN
  71.                         Async_Send( Ch );       (* echo 1 char at a time *)
  72.                         FileName := FileName + Ch;
  73.                         WRITE( Ch );
  74.                      END;
  75.  
  76.                UNTIL ORD(Ch) IN [ACK,CAN];
  77.  
  78.                IF ORD( Ch ) = ACK THEN
  79.                      BEGIN  (* Filename echoed correctly *)
  80.  
  81.                         FOR X := 0 TO 18 DO
  82.                            WRITELN;
  83.  
  84.                         IF POS( '=X' , FileName ) <> 0 THEN
  85.                            DELETE( FileName , POS( '=X' , FileName ) , 2 );
  86.  
  87.                         FileName := TRIM( FileName );
  88.  
  89.                         PibDownload( Xmodem_Chk );
  90.  
  91.                      END;
  92.  
  93.             END  (* Auto_DownLoad *);
  94.  
  95.       '2' : BEGIN  (* Draw a Box at corners (Oldx,Oldy) and (NewX,NewY) *)
  96.                Draw_Box( OldX, OldY, NewX, NewY,
  97.                          Global_Text_Attribute, Menu_Text_Color, '' );
  98.             END;
  99.  
  100.       ELSE;
  101.  
  102.    END (* CASE *);
  103.  
  104. END   (* Exec_PC_Commands *);
  105.  
  106.