home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / pibterm / pibt41s4.arc / SETDISPL.MOD < prev    next >
Text File  |  1988-02-21  |  6KB  |  174 lines

  1. (*----------------------------------------------------------------------*)
  2. (*         Set_Display_Actions --- Set up display actions for emulation *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE Set_Display_Actions;
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*     Procedure:  Set_Display_Actions                                  *)
  10. (*                                                                      *)
  11. (*     Purpose:    Set display actions for current emulation type       *)
  12. (*                                                                      *)
  13. (*     Calling Sequence:                                                *)
  14. (*                                                                      *)
  15. (*        Set_Display_Actions;                                          *)
  16. (*                                                                      *)
  17. (*----------------------------------------------------------------------*)
  18.  
  19. VAR
  20.    Ch        : CHAR;
  21.    I         : INTEGER;
  22.    N         : INTEGER;
  23.    P1        : Display_Action_Chars_Ptr;
  24.    P2        : Display_Action_Actions_Ptr;
  25.    F         : FILE;
  26.    TDef_Name : AnyStr;
  27.  
  28. BEGIN (* Set_Display_Actions *)
  29.  
  30.                                    (* Assume no special actions as default *)
  31.  
  32.    FOR Ch := CHR( 0 ) TO CHR( 255 ) DO
  33.       BEGIN
  34.          Display_Action_Ptr[1]^  [ Ch ] := DisplayChar;
  35.          Display_Char_Set_Ptr[1]^[ Ch ] := Ch;
  36.       END;
  37.                                    (* Assume second char set same as first *)
  38.  
  39.    MOVE( Display_Char_Set_Ptr[1]^, Display_Char_Set_Ptr[2]^, 256 );
  40.  
  41.                                    (* Start in state 1, character set 1    *)
  42.    Display_Action_State  := 1;
  43.    Character_Set_Ptr     := Display_Char_Set_Ptr[1];
  44.  
  45.                                    (* If user terminal definition, read    *)
  46.                                    (* definition file.                     *)
  47.  
  48.    IF ( Terminal_To_Emulate IN [User1..User5] ) THEN
  49.       BEGIN
  50.  
  51.          N := ORD( Terminal_To_Emulate ) - ORD( User1 ) + 1;
  52.  
  53.          TDef_Name := User_Term_Name[N];
  54.  
  55.          Add_Path( TDef_Name, Home_Dir, TDef_Name );
  56.  
  57.          ASSIGN( F , TDef_Name );
  58.             (*!I-*)
  59.          RESET( F );
  60.             (*!I+*)
  61.  
  62.          IF ( INT24Result = 0 ) THEN
  63.             BEGIN
  64.  
  65.                N := ORD( Terminal_To_Emulate );
  66.  
  67.                                    (* Get terminal name *)
  68.  
  69.                BlockRead( F, Long_Terminal_Names[N], 12 );
  70.                Long_Terminal_Names[N][0] := CHR( 12 );
  71.  
  72.                                    (* Get # of display action vectors *)
  73.  
  74.                BlockRead( F, N, 2 );
  75.  
  76.                                    (* Read display action vector *)
  77.                FOR I := 1 TO N DO
  78.                   BEGIN
  79.                      IF ( Display_Action_Ptr[I] = NIL ) THEN
  80.                         NEW( Display_Action_Ptr[I] );
  81.                      IF ( Display_Action_Ptr[I] <> NIL ) THEN
  82.                         BlockRead( F, Display_Action_Ptr[I]^, 256 );
  83.                   END;
  84.  
  85.                                    (* Get # of character sets *)
  86.  
  87.                BlockRead( F, N, 2 );
  88.  
  89.                                    (* Read character sets *)
  90.                FOR I := 1 TO N DO
  91.                   BEGIN
  92.                      IF ( Display_Char_Set_Ptr[I] = NIL ) THEN
  93.                         NEW( Display_Char_Set_Ptr[I] );
  94.                      IF ( Display_Char_Set_Ptr[I] <> NIL ) THEN
  95.                         BlockRead( F, Display_Char_Set_Ptr[I]^, 256 );
  96.                   END;
  97.  
  98.             END
  99.          ELSE
  100.             BEGIN
  101.                WRITELN;
  102.                WRITELN('Can''t open terminal definition file ',TDef_Name);
  103.                WRITELN('Dumb terminal assumed.');
  104.                Terminal_To_Emulate := Dumb;
  105.                Press_Any;
  106.             END;
  107.  
  108.             (*!I-*)
  109.         CLOSE( F );
  110.             (*!I+*)
  111.  
  112.         I := INT24Result;
  113.  
  114.         EXIT;
  115.  
  116.       END;
  117.                                    (* Else alter display information *)
  118.                                    (* based upon terminal type       *)
  119.    CASE Terminal_To_Emulate OF
  120.  
  121.       ADM3a:  BEGIN
  122.                  N  := MaxAdm3aChars;
  123.                  P1 := ADDR( ADM3a_Chars );
  124.                  P2 := ADDR( ADM3a_Actions );
  125.               END;
  126.  
  127.       ADM5:   BEGIN
  128.                  N  := MaxAdm5Chars;
  129.                  P1 := ADDR( ADM5_Chars );
  130.                  P2 := ADDR( ADM5_Actions );
  131.               END;
  132.  
  133.       VT52:   BEGIN
  134.                  N  := MaxVT52Chars;
  135.                  P1 := ADDR( VT52_Chars );
  136.                  P2 := ADDR( VT52_Actions );
  137.                  FOR I := 95 TO 126 DO
  138.                     Display_Char_Set_Ptr[2]^[CHR(I)] := CHR(VT100_Graphics_Chars[I]);
  139.                  Number_Tab_Stops := Number_VT52_Tabs;
  140.                  MOVE( VT52_Tabs[1], Tab_Stops[1], Number_VT52_Tabs );
  141.               END;
  142.  
  143.       TV925:  BEGIN
  144.                  N  := MaxTV925Chars;
  145.                  P1 := ADDR( TV925_Chars );
  146.                  P2 := ADDR( TV925_Actions );
  147.               END;
  148.  
  149.       ELSE
  150.               N := 0;
  151.  
  152.    END (* CASE *);
  153.                                    (* Insert information into vectors as needed *)
  154.    FOR I := 1 TO N DO
  155.       Display_Action_Ptr[1]^[P1^[I]] := P2^[I];
  156.  
  157.                                    (* Set CompuServe B protocol actions *)
  158.    IF CompuServe_B_On THEN
  159.       BEGIN
  160.          Display_Action_Ptr[1]^[ CHR( DLE ) ] := DoCISBDLE;
  161.          Display_Action_Ptr[1]^[ CHR( ETX ) ] := DoCISBENQ;
  162.          Display_Action_Ptr[1]^[ CHR( ENQ ) ] := DoCISBENQ;
  163.          Display_Action_Ptr[1]^[ 'I'        ] := DoCISBESCI;
  164.       END;
  165.                                    (* Set Zmodem protocol actions *)
  166.    IF Zmodem_Autodownload THEN
  167.       Display_Action_Ptr[1]^[ CHR( CAN ) ] := DoZmodemReceive;
  168.  
  169.                                    (* Set Kermit protocol actions *)
  170.    IF Kermit_Autodownload THEN
  171.          Display_Action_Ptr[1]^[ CHR( SOH ) ] := DoKermitReceive;
  172.  
  173. END   (* Set_Display_Actions *);
  174.