unit kermglob;

interface

   const blksize = 512;
         oport = 8;          (* output port # *)
         inport = 7;
         keyport = 2;
         bell = 7;           (* ASCII bell *)
         maxpack = 93;       (* maximum packet size minus 1 *)
         soh = 1;            (* start of header *)
         sp = 32;            (* ASCII space *)
         cr = 13;            (* ASCII CR *)
         lf = 10;            (* ASCII line feed *)
         xdle = 16;           (* ASCII DLE (space compression prefix for psystem) *)
         del = 127;          (* delete *)
         my_esc = 29;        (* default esc char for connect (^]) *)
         maxtry = 5;         (* number of times to retry sending packet *)
         my_quote = '#';     (* quote character I'll use *)
         my_pad = 0;         (* number of padding chars I need *)
         my_pchar = 0;       (* padding character I need *)
         my_eol = 13;        (* end of line character i need *)
         my_time = 5;        (* seconds after which I should be timed out *)
         maxtim = 20;        (* maximum timeout interval *)
         mintim = 2;         (* minimum time out interval *)
         at_eof = -1;        (* value to return if at eof *)
         rqsize = 5000;      (* input queue size *)
         qsize1 = 5001;      (* qsize + 1 *)
         eoln_sym = 13;      (* pascal eoln sym *)
         back_space = 8;     (* pascal backspace sym *)
         defaultbaud = 1200; (* default baud rate *)

   (* screen control information *)
     (* console line on which to put specified info *)
         title_line = 1;
         statusline = 2;
         packet_line = 3;
         retry_line = 4;
         file_line = 5;
         error_line = 6;
         debug_line = 7;
         prompt_line = 8;
     (* position on line to put info *)
         statuspos = 70;
         packet_pos = 19;
         retry_pos = 17;
         file_pos = 11;

   type packettype = packed array[0..maxpack] of char;
        parity_type = (evenpar, oddpar, markpar, spacepar, nopar);

        char_int_rec = record (* allows character to be treated as integer... *)
                              (* is system dependent *)
                         case boolean of
                             true: (i: integer);
                             false: (ch: char)
                       end; (* record *)

        int_bool_rec = record (* allows integer to be treated as boolean... *)
                              (* used for numeric and, or, xor...system dependent *)
                         case boolean of
                             true: (i: integer);
                             false: (b: boolean)
                       end; (* record *)

        string255 = string[255];


        statustype = (null, at_eol, unconfirmed, parm_expected, ambiguous,
                      unrec, fn_expected, ch_expected, num_expected);
        vocab = (nullsym, allsym, baudsym, consym, debugsym, emulatesym,
                 escsym, evensym, exitsym, filewarnsym,helpsym, ibmsym,
                 localsym, marksym, nonesym, oddsym, offsym, onsym, paritysym,
                 quitsym, recsym, sendsym, setsym, showsym, spacesym);

        scrcommands = (sc_up, sc_right, sc_clreol, sc_clreos, sc_home,
                       sc_escape, sc_left, sc_clrall, scr_clrline);

    var noun, verb, adj: vocab;
        status: statustype;
        vocablist: array[vocab] of string255;
        xfilename, line: string255;
        newescchar: char;
        expected: set of vocab;
        newbaud: integer;

        currstate: char; (* current state *)
        f: file of char; (* file to be received *)
        oldf: file; (* file to be sent *)
        s: string255;
        xeol, quote, esc_char: char;
        fwarn, ibm, half_duplex, debug: boolean;
        i, size, rpsiz, spsiz, pad, n, num_try, oldtry, timint: integer;
        recpkt, packet: packettype;
        padchar, ch: char;
        debf: text; (* file for debug output *)
        parity: parity_type;
        xon: char;
        filebuf: packed array[1..1024] of char;
        bufpos, bufend: integer;
        parity_array: packed array[char] of char;
        ctlset: set of char;
        rec_ok, send_ok: boolean;
        baud: integer;
        emulating: boolean;

implementation


end. { kermglob }

