;;; -*- Mode: Common-Lisp; Package: User; Base: 10.; Patch-File: T -*-
;;; Patch file for KERMIT version 3.3
;;; Reason: Handle serial-ascii-stream tranlation the SNA way.  sjf 8-21-87
;;; Written 08/21/87 17:00:29 by FORD,
;;; while running on Blumenthal from band LOD1
;;; With IO 3.10, PATHNAME 3.8, FILE 3.5, SYSTEM 3.22, METER 3.1, SERIAL 3.0, CHAOSNET 3.8, ETHERNET 3.0, GC 3.7, IMAGEN 3.0, MAIL-DAEMON 3.1, NETWORK-SUPPORT 3.6, PROFILE 3.0, SUGGESTIONS 3.3, UCL 3.0, ZWEI 3.4, STREAMER-TAPE 3.2, DEBUG-TOOLS 3.0, FONT-EDITOR 3.0, GLOSSARY 3.0, INPUT-EDITOR 3.0, MAIL-READER 3.0, NAMESPACE-EDITOR 3.2, NVRAM 3.0, TELNET 3.0, TV 3.4, NAMESPACE 3.7, COMPILER 3.2, PRINTER 3.1, SYSLOG 3.0, VT100 3.1, Experimental KERMIT 3.1, Experimental SNA 1.0,  microcode 355, Band Name: Release 3.0 - 6/9.



#!C
; From file SERIAL-CHANGES.LISP#> PUBLIC.KERMIT; Blumenthal:
#10R SYSTEM#:
(COMPILER-LET ((*PACKAGE* (FIND-PACKAGE "SYSTEM"))
                          (SI:*LISP-MODE* :COMMON-LISP)
                          (*READTABLE* COMMON-LISP-READTABLE)
                          (SI:*READER-SYMBOL-SUBSTITUTIONS* *COMMON-LISP-SYMBOL-SUBSTITUTIONS*))
  (COMPILER#:PATCH-SOURCE-FILE "sys:PUBLIC.KERMIT; SERIAL-CHANGES.#"



;;; The ascii-translating-input-stream-mixin expects the return character to be sent as a <CR><LF> 
;;; combination, a throw back to the TELNET protocol.  Host systems using serial streams
;;; are not required to send <CR><LF>.  Thus the standard input ascii translating can
;;; hang a serial stream by waiting for the <LF> character which never is sent. 
;;;
;;; This is the same wrapper as for the translating stream except that a
;;; modified translating function is called.
(defwrapper (serial-ascii-stream :tyi) (ignore . body)
  `(progn
     .daemon-caller-args.			;prevent compiler warnings
     (tyi-from-serial-stream #'(lambda (&rest .daemon-caller-args.
					      &aux (.daemon-mapping-table.
						     self-mapping-table))
				 .daemon-mapping-table.
				 . ,body))))

;;; Essentially the same function that is called by the ascii-translating-input-stream-mixin.
;;; The ascii CR character is converted without attempting to read a second character
;;; (a ascii LF character) from the network stream.
(defun tyi-from-serial-stream (ascii-stream &aux ch)
  (case (setq ch  (funcall ascii-stream :tyi))
    (8. #.(char-int #\BACKSPACE))
    (9. #.(char-int #\TAB))
    (10. #.(char-int #\LINEFEED))
    (12. #.(char-int #\PAGE))
    (13. #.(char-int #\NEWLINE))
    (127. #.(char-int #\RUBOUT))
    (nil nil)
    (T (char-int CH))))
))
