(FILECREATED " 4-Jul-85 00:21:24" {ERIS}<LISP>INTERMEZZO>PATCHES>SPPPATCH2.;4 7512   

      changes to:  (FNS SPP.OPEN)
		   (VARS SPPPATCH2COMS)
		   (RECORDS SPPCON)

      previous date: " 3-Jul-85 23:58:17" {ERIS}<LISP>INTERMEZZO>PATCHES>SPPPATCH2.;2)


(PRETTYCOMPRINT SPPPATCH2COMS)

(RPAQQ SPPPATCH2COMS ((RECORDS SPPCON SPPSTREAM)
		      (FNS SPP.OPEN)))
[DECLARE: EVAL@COMPILE 

(DATATYPE SPPCON ((SPPXIPLENGTH WORD)
		  (NIL BYTE)
		  (SPPXIPTYPE BYTE)
		  (SPPDESTNSADDRESS0 5 WORD)
		  (SPPDESTSKT# WORD)
		  (SPPSOURCENSADDRESS0 5 WORD)
		  (SPPSOURCESKT# WORD)
		  (NIL BYTE)
		  (SPPDSTYPE BYTE)
		  (SPPSOURCEID WORD)
		  (SPPDESTID WORD)
		  (SPPSEQNO WORD)
		  (SPPACKNO WORD)
		  (SPPACCEPTNO WORD)
		  (SPPESTABLISHEDP FLAG)
		  (SPPDESTINATIONKNOWN FLAG)
		  (SPPTERMINATEDP FLAG)
		  (SPPOUTPUTABORTEDP FLAG)
		  (SPPACKPENDING FLAG)
		  (SPPEOMONFORCEOUT FLAG)
		  (SPPSPAREFLAG FLAG)
		  (SPPOUTPUTABORTEDFN POINTER)
		  (SPPINPUTQ POINTER)
		  (SPPRETRANSMITQ POINTER)
		  (SPPRETRANSMITTING POINTER)
		  (SPPLOCK POINTER)
		  (SPPMYNSOCKET POINTER)
		  (SPPACKEDSEQNO WORD)
		  (SPPOUTPUTALLOCNO WORD)
		  (SPPRETRANSMITTIMER POINTER)
		  (SPPACKREQUESTED POINTER)
		  (SPPACKREQTIME POINTER)
		  (SPPACKREQTIMEOUT POINTER)
		  (SPPROUNDTRIPTIME POINTER)
		  (SPPACTIVITYTIMER POINTER)
		  (SPPATTENTIONFN POINTER)
		  (SPPINPKT POINTER)
		  (SPPOUTPKT POINTER)
		  (SPPSYSPKT POINTER)
		  (SPPINPUTSTREAM POINTER)
		  (SPPSUBSTREAM POINTER)
		  (SPPPROCESS POINTER)
		  (SPPALLOCATIONEVENT POINTER)
		  (SPPINPUTEVENT POINTER)
		  (SPPOUTPUTSTREAM POINTER)
		  (SPPWHENCLOSEDFN POINTER)
		  (SPPSTATE POINTER)
		  (SPPERRORHANDLER POINTER)
		  (SPPSPARE POINTER)))

(ACCESSFNS SPPSTREAM ((SPP.CONNECTION (fetch F1 of DATUM)
				      (replace F1 of DATUM with NEWVALUE))
		      (BULK.DATA.CONTINUATION (fetch F2 of DATUM)
					      (replace F2 of DATUM with NEWVALUE))
		      (SPPEOFBITS (fetch FW8 of DATUM)
				  (replace FW8 of DATUM with NEWVALUE))
		      (SPPFILEPTRHI (fetch FW6 of DATUM)
				    (replace FW6 of DATUM with NEWVALUE))
		      (SPPFILEPTRLO (fetch FW7 of DATUM)
				    (replace FW7 of DATUM with NEWVALUE)))
		     [ACCESSFNS SPPSTREAM ([SPPEOFP (SELECTC (fetch SPPEOFBITS of DATUM)
							     (0 NIL)
							     (\SPPFLAG.END (QUOTE END))
							     (\SPPFLAG.ATTENTION (QUOTE ATTENTION))
							     (\SPPFLAG.EOM (QUOTE EOM))
							     NIL)
						    (replace SPPEOFBITS of DATUM
						       with (SELECTQ NEWVALUE
								     (NIL 0)
								     (EOM \SPPFLAG.EOM)
								     (END \SPPFLAG.END)
								     (ATTENTION \SPPFLAG.ATTENTION)
								     (\ILLEGAL.ARG NEWVALUE]
				 (SPPFILEPTR (\MAKENUMBER (fetch SPPFILEPTRHI of DATUM)
							  (fetch SPPFILEPTRLO of DATUM])
]
(/DECLAREDATATYPE (QUOTE SPPCON)
		  (QUOTE (WORD BYTE BYTE WORD WORD WORD WORD WORD WORD WORD WORD WORD WORD WORD WORD 
			       BYTE BYTE WORD WORD WORD WORD WORD FLAG FLAG FLAG FLAG FLAG FLAG FLAG 
			       POINTER POINTER POINTER POINTER POINTER POINTER WORD WORD POINTER 
			       POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER 
			       POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER 
			       POINTER POINTER POINTER))
		  (QUOTE ((SPPCON 0 (BITS . 15))
			  (SPPCON 1 (BITS . 7))
			  (SPPCON 1 (BITS . 135))
			  (SPPCON 2 (BITS . 15))
			  (SPPCON 3 (BITS . 15))
			  (SPPCON 4 (BITS . 15))
			  (SPPCON 5 (BITS . 15))
			  (SPPCON 6 (BITS . 15))
			  (SPPCON 7 (BITS . 15))
			  (SPPCON 8 (BITS . 15))
			  (SPPCON 9 (BITS . 15))
			  (SPPCON 10 (BITS . 15))
			  (SPPCON 11 (BITS . 15))
			  (SPPCON 12 (BITS . 15))
			  (SPPCON 13 (BITS . 15))
			  (SPPCON 14 (BITS . 7))
			  (SPPCON 14 (BITS . 135))
			  (SPPCON 15 (BITS . 15))
			  (SPPCON 16 (BITS . 15))
			  (SPPCON 17 (BITS . 15))
			  (SPPCON 18 (BITS . 15))
			  (SPPCON 19 (BITS . 15))
			  (SPPCON 20 (FLAGBITS . 0))
			  (SPPCON 20 (FLAGBITS . 16))
			  (SPPCON 20 (FLAGBITS . 32))
			  (SPPCON 20 (FLAGBITS . 48))
			  (SPPCON 20 (FLAGBITS . 64))
			  (SPPCON 20 (FLAGBITS . 80))
			  (SPPCON 20 (FLAGBITS . 96))
			  (SPPCON 20 POINTER)
			  (SPPCON 22 POINTER)
			  (SPPCON 24 POINTER)
			  (SPPCON 26 POINTER)
			  (SPPCON 28 POINTER)
			  (SPPCON 30 POINTER)
			  (SPPCON 32 (BITS . 15))
			  (SPPCON 33 (BITS . 15))
			  (SPPCON 34 POINTER)
			  (SPPCON 36 POINTER)
			  (SPPCON 38 POINTER)
			  (SPPCON 40 POINTER)
			  (SPPCON 42 POINTER)
			  (SPPCON 44 POINTER)
			  (SPPCON 46 POINTER)
			  (SPPCON 48 POINTER)
			  (SPPCON 50 POINTER)
			  (SPPCON 52 POINTER)
			  (SPPCON 54 POINTER)
			  (SPPCON 56 POINTER)
			  (SPPCON 58 POINTER)
			  (SPPCON 60 POINTER)
			  (SPPCON 62 POINTER)
			  (SPPCON 64 POINTER)
			  (SPPCON 66 POINTER)
			  (SPPCON 68 POINTER)
			  (SPPCON 70 POINTER)
			  (SPPCON 72 POINTER)))
		  (QUOTE 74))
(DEFINEQ

(SPP.OPEN
  [LAMBDA (HOST SOCKET PROBEP NAME PROPS)                    (* gbn " 4-Jul-85 00:21")
    (LET ((CON (\SPPCONNECTION HOST SOCKET NAME)))
      (RESETLST (RESETSAVE NIL (LIST [FUNCTION (LAMBDA (CON)
					 (LET ((SOCKET (fetch (SPPCON SPPMYNSOCKET) of CON)))
					   (AND RESETSTATE (type? NSOCKET SOCKET)
						(CLOSENSOCKET SOCKET T]
				     CON))
		(WITH.MONITOR (fetch SPPLOCK of CON)
			      (PROG (INSTREAM OUTSTREAM)
				    (RETURN (COND
					      ((COND
						  ((NULL HOST)
                                                             (* Passive connection)
						    (until (fetch SPPESTABLISHEDP of CON)
						       do (MONITOR.AWAIT.EVENT (fetch SPPLOCK
										  of CON)
									       (fetch SPPINPUTEVENT
										  of CON)))
						    (fetch SPPESTABLISHEDP of CON))
						  ((OR (fetch SPPESTABLISHEDP of CON)
						       (NOT PROBEP))
						    T)
						  (T (\SPP.PROBE CON)
						     (MONITOR.AWAIT.EVENT (fetch SPPLOCK
									     of CON)
									  (fetch SPPINPUTEVENT
									     of CON)
									  SPP.USER.TIMEOUT)
						     (fetch SPPESTABLISHEDP of CON)))
						[replace SPPINPUTSTREAM of CON
						   with (SETQ INSTREAM (\SPP.CREATE.STREAM
							    (QUOTE INPUT]
						(replace SPP.CONNECTION of INSTREAM with CON)
						(replace STRMBOUTFN of INSTREAM
						   with (FUNCTION \SPP.OTHER.BOUT))
						[replace SPPOUTPUTSTREAM of CON
						   with (SETQ OUTSTREAM (\SPP.CREATE.STREAM
							    (QUOTE OUTPUT]
						(replace SPP.CONNECTION of OUTSTREAM with CON)
						(for TAIL on PROPS by (CDDR TAIL)
						   do (SELECTQ (CAR TAIL)
							       (CLOSEFN (replace SPPWHENCLOSEDFN
									   of CON
									   with (CADR TAIL)))
							       (ATTENTIONFN (replace SPPATTENTIONFN
									       of CON
									       with (CADR TAIL)))
							       (ERRORHANDLER (replace SPPERRORHANDLER
										of CON
										with (CADR TAIL)))
							       (EOM.ON.FORCEOUT (replace 
										 SPPEOMONFORCEOUT
										   of CON
										   with (CADR TAIL)))
							       NIL))
						(push (fetch DEVICEINFO of \SPPDEVICE)
						      INSTREAM)
						INSTREAM])
)
(DECLARE: DONTCOPY
  (FILEMAP (NIL (4993 7490 (SPP.OPEN 5003 . 7488)))))
STOP