home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / pibterm / pibt41s1.arc / FINITERM.MOD < prev    next >
Text File  |  1988-01-17  |  3KB  |  95 lines

  1. (*----------------------------------------------------------------------*)
  2. (*                  FiniTerm --- Finish up PibTerm                      *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE FiniTerm;
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*     Procedure:  FiniTerm                                             *)
  10. (*                                                                      *)
  11. (*     Purpose:    Terminates PibTerm                                   *)
  12. (*                                                                      *)
  13. (*     Calling Sequence:                                                *)
  14. (*                                                                      *)
  15. (*        FiniTerm;                                                     *)
  16. (*                                                                      *)
  17. (*----------------------------------------------------------------------*)
  18.  
  19. VAR
  20.    I             : INTEGER;
  21.    Vid_Mode      : INTEGER;
  22.  
  23. BEGIN (* FiniTerm *)
  24.                                    (* Make sure we're in text mode *)
  25.  
  26.    Vid_Mode      := Current_Video_Mode;
  27.    IF ( ( Vid_Mode >= MedRes_GraphMode ) AND
  28.         ( Vid_Mode <> Mono_TextMode    ) ) THEN
  29.       Set_Text_Mode( Text_Mode );
  30.  
  31.                                    (* Close down serial port   *)
  32.    Async_Close( Drop_Dtr_At_End );
  33.                                    (* Remove buffers               *)
  34.    Async_Release_Buffers;
  35.                                    (* Turn off keyboard handler    *)
  36.    IF Extended_Keypad THEN
  37.       Remove_Keyboard_Handler;
  38.                                    (* Turn off video handler       *)
  39.    IF Software_Scroll THEN
  40.       Remove_Video_Handler;
  41.                                    (* Close all script files           *)
  42.  
  43.    FOR I := 1 TO MaxScriptOpenFiles DO
  44.       IF Script_File_Used[I] THEN
  45.          BEGIN
  46.             IF Script_File_List[I]^.Opened THEN
  47.                BEGIN
  48.                      (*!I-*)
  49.                   CLOSE( Script_File_List[I]^.F );
  50.                      (*!I+*)
  51.                   I := Int24Result;
  52.                END;
  53.          END;
  54.                                    (* Close capture file       *)
  55.    IF Capture_On THEN
  56.          (*!I-*)
  57.       BEGIN
  58.          CLOSE( Capture_File );
  59.          I := Int24Result;
  60.       END;
  61.          (*!I+*)
  62.                                    (* Close log file           *)
  63.    IF Log_File_Open THEN
  64.          (*!I-*)
  65.       BEGIN
  66.          CLOSE( Log_File );
  67.          I := Int24Result;
  68.       END;
  69.  
  70.          (*!I+*)
  71.                                    (* Close down print spooling *)
  72.    IF Print_Spooling THEN
  73.       BEGIN
  74.          CLOSE( Spool_File );
  75.          DISPOSE( Spool_Buffer );
  76.          I := Int24Result;
  77.       END;
  78.                                    (* Close printer *)
  79.    CLOSE( LST );
  80.    I := Int24Result;
  81.                                    (* Remove scrolling buffer  *)
  82.  
  83.    MyFreeMem( Review_Buffer , Max_Review_Length );
  84.  
  85.                                  (* Remove Interrupt 24 trap *)
  86.    Int24OFF( FALSE );
  87.  
  88.    TextColor( LightGray );
  89.    TextBackGround( Black );
  90.    Set_Border_Color( Black );
  91.  
  92.    ExitProc := ExitSave;
  93.  
  94. END   (* FiniTerm *);
  95.