(*----------------------------------------------------------------------*)
(*              Kermit_Tab --- Expand tabs in Kermit packets            *)
(*----------------------------------------------------------------------*)

FUNCTION Kermit_Tab( Spaces : INTEGER ) : AnyStr;

(*----------------------------------------------------------------------*)
(*                                                                      *)
(*     Function:   Kermit_Tab                                           *)
(*                                                                      *)
(*     Purpose:    Expand tabs in Kermit packets.                       *)
(*                                                                      *)
(*     Calling Sequence:                                                *)
(*                                                                      *)
(*        ExpString := Kermit_Tab( Spaces : INTEGER ) : AnyStr;         *)
(*                                                                      *)
(*----------------------------------------------------------------------*)

BEGIN (* Kermit_Tab *)

   Kermit_Tab := Dupl( ' ' , Spaces );

END   (* Kermit_Tab *);

(*----------------------------------------------------------------------*)
(*         Kermit_Ctrl --- Convert control character to letter          *)
(*----------------------------------------------------------------------*)

FUNCTION Kermit_Ctrl( Ch : CHAR ) : CHAR;

(*----------------------------------------------------------------------*)
(*                                                                      *)
(*     Function:   Kermit_Ctrl                                          *)
(*                                                                      *)
(*     Purpose:    Convert control character to letter                  *)
(*                                                                      *)
(*     Calling Sequence:                                                *)
(*                                                                      *)
(*        CtrlCh := Kermit_Ctrl( Ch : CHAR ) : CHAR;                    *)
(*                                                                      *)
(*----------------------------------------------------------------------*)

BEGIN (* Kermit_Ctrl *)

   Kermit_Ctrl := CHR( ORD( Ch ) XOR $40 );

END   (* Kermit_Ctrl *);


(*----------------------------------------------------------------------*)
(*         Kermit_Char40 --- Add octal 40 to a character                *)
(*----------------------------------------------------------------------*)

FUNCTION Kermit_Char40( Number : INTEGER ) : CHAR;

(*----------------------------------------------------------------------*)
(*                                                                      *)
(*     Function:   Kermit_Char40                                        *)
(*                                                                      *)
(*     Purpose:    Add octal 40 to a character                          *)
(*                                                                      *)
(*     Calling Sequence:                                                *)
(*                                                                      *)
(*        Ch40 := Kermit_Char40( Number : INTEGER ) : CHAR;             *)
(*                                                                      *)
(*----------------------------------------------------------------------*)

VAR
   Byte_Number : BYTE;

BEGIN (* Kermit_Char40 *)

   Byte_Number := Number;

   Kermit_Char40 := CHR( Byte_Number + 32 );

END   (* Kermit_Char40 *);

(*----------------------------------------------------------------------*)
(*         Kermit_UnChar --- Add octal 40 to a character                *)
(*----------------------------------------------------------------------*)

FUNCTION Kermit_UnChar( Ch : CHAR ) : INTEGER;

(*----------------------------------------------------------------------*)
(*                                                                      *)
(*     Function:   Kermit_UnChar                                        *)
(*                                                                      *)
(*     Purpose:    Convert letter to control character                  *)
(*                                                                      *)
(*     Calling Sequence:                                                *)
(*                                                                      *)
(*        Ch40 := Kermit_UnChar( Ch : CHAR ) : INTEGER;                 *)
(*                                                                      *)
(*----------------------------------------------------------------------*)

BEGIN (* Kermit_UnChar *)

   Kermit_UnChar := ORD( Ch ) - 32;

END   (* Kermit_UnChar *);

(*----------------------------------------------------------------------*)
(*              Kermit_Init --- Initialize global Kermit variables      *)
(*----------------------------------------------------------------------*)

PROCEDURE Kermit_Init;

(*----------------------------------------------------------------------*)
(*                                                                      *)
(*     Procedure:  Kermit_Init                                          *)
(*                                                                      *)
(*     Purpose:    Initializes global Kermit variables                  *)
(*                                                                      *)
(*     Calling Sequence:                                                *)
(*                                                                      *)
(*        Kermit_Init;                                                  *)
(*                                                                      *)
(*----------------------------------------------------------------------*)

BEGIN (* Kermit_Init *)
                                   (* Ascii is default if not given *)

   IF Kermit_File_Type_Var = Kermit_None THEN
      Kermit_File_Type_Var := Kermit_Ascii;

                                   (* Default checksum method *)
   His_Chk_Type          := '1';

                                   (* Initial packet size *)

   Kermit_Packet_Size   := Kermit_Init_Packet_Size;

                                   (* Don't send padding unless requested *)
   My_Pad_Num    := 0;
   My_Pad_Char   := Kermit_Pad_Char;

                                   (* Send a CR to start with *)

   Send_EOL      := ORD( Kermit_EOL );

                                   (* No 8-bit quoting unless binary with parity *)
   Quoting       := FALSE;
                                   (* Time out *)
   His_TimeOut   := Kermit_TimeOut;

                                   (* 8-but quote *)

   His_Quote_8_Char := Kermit_Quote_8_Char;

END   (* Kermit_Init *);
