(DEFINE-FILE-INFO READTABLE "XCL" PACKAGE "INTERLISP") (FILECREATED " 2-Jul-90 15:10:58" |{DSK}bane>LISP>CHATSERVER-EMACS.;3| 5071 |changes| |to:| (VARS CHATSERVER-EMACSCOMS) |previous| |date:| " 1-Jul-90 17:52:53" |{DSK}bane>LISP>CHATSERVER-EMACS.;2|) ; Copyright (c) 1990 by VENUE. All rights reserved. (PRETTYCOMPRINT CHATSERVER-EMACSCOMS) (RPAQQ CHATSERVER-EMACSCOMS ((FNS EMACSCHATSERVEROPENFN UNIXCHATSERVER UNIX.CHAT.LISTENER) (VARS UNIX.CHAT.SOCKET) (P (SETQ DISPLAYTERMFLG NIL) (* \; "EMACS doesn't grok DM2500 escapes") (SETQ EMACSCSTTBL (COPYTERMTABLE (QUOTE ORIG))) (* \; "EMACS wants no echoing and LF to mean accept input") (SETSYNTAX (CHARCODE LF) (QUOTE EOL) EMACSCSTTBL) (ECHOMODE NIL EMACSCSTTBL)) (DECLARE\: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS (ADDVARS (NLAMA) (NLAML) (LAMA EMACSCHATSERVEROPENFN))))) (DEFINEQ (EMACSCHATSERVEROPENFN (CL:LAMBDA (*KEYBOARD-STREAM* OUTSTREAM) (* \; "Edited 12-Jun-90 15:02 by jrb:") (* |;;| "Code stolen from CHATSERVEROPENFN and munged slightly (different (STREAM EOLCONVENTION), etc.)") (CL:UNWIND-PROTECT (PROGN (LINELENGTH 80 OUTSTREAM) (PAGEHEIGHT 24 OUTSTREAM) (STREAMPROP *KEYBOARD-STREAM* (QUOTE SERVER.PROCESS) (THIS.PROCESS)) (STREAMPROP *KEYBOARD-STREAM* (QUOTE AFTERCLOSE) (QUOTE CHATSERVERWHENCLOSEDFN)) (STREAMPROP OUTSTREAM (QUOTE SERVER.PROCESS) (THIS.PROCESS)) (STREAMPROP OUTSTREAM (QUOTE AFTERCLOSE) (QUOTE CHATSERVERWHENCLOSEDFN)) (COND ((|fetch| (FDEV BUFFERED) |of| (|fetch| (STREAM DEVICE) |of| OUTSTREAM)) (* |;;| "output is a buffered device: spawn/restart process to send it out") (|pushnew| \\SWEPT.OFDS OUTSTREAM) (DEL.PROCESS (QUOTE SWEEP.OFD)) (ADD.PROCESS (QUOTE (SWEEP.OFD))))) (OR \\SIMPLEIMAGEOPS (SETQ \\SIMPLEIMAGEOPS (|create| IMAGEOPS |using| \\NOIMAGEOPS IMFONT _ (QUOTE CHATSERVER.FONT)))) (AND (EQ (|fetch| IMAGEOPS |of| OUTSTREAM) \\NOIMAGEOPS) (|replace| IMAGEOPS |of| OUTSTREAM |wi th| \\SIMPLEIMAGEOPS)) (|replace| (STREAM OUTCHARFN) |of| OUTSTREAM |with| (FUNCTION \\REMOTE.EXEC.OUTCHARFN)) (|replace| (STREAM EOLCONVENTION) |of| OUTSTREAM |with| LF.EOLC) (|if| (EQ (|fetch| (STREAM STRMBINFN) |of| *KEYBOARD-STREAM*) (|fetch| (FDEV BIN) (|fetch| (STREAM DEVICE) *KEYBOARD-STREAM*))) |then| (|replace| (STREAM STRMBINFN) |of| *KEYBOARD-STREAM* |with| (QUOTE \\REMOTE.BIN)) |elseif| (NOT (EQ (|fetch| (STREAM STRMBINFN) |of| *KEYBOARD-STREAM*) (QUOTE \\REMOTE.BIN))) |then| (PRINTOUT OUTSTREAM "[Interrupts not enabled]" T)) (LET* ((BUFFERED (\\CREATELINEBUFFER *KEYBOARD-STREAM*)) (\\TERM.OFD OUTSTREAM) (*STANDARD-OUTPUT* \\TERM.OFD) (\\LINEBUF.OFD BUFFERED) (*STANDARD-INPUT* \\LINEBUF.OFD) (*TRACE-OUTPUT* *STANDARD-OUTPUT*) (\\PRIMTERMTABLE EMACSCSTTBL) (DBG::*DEBUGGER-TERMINAL-TABLE* EMACSCSTTBL) (ASKUSERTTBL EMACSCSTTBL)) (DECLARE (CL:SPECIAL PROMPTWINDOW \\TERM.OFD *STANDARD-OUTPUT* \\LINEBUF.OFD *STANDARD-INPUT* \\PRIMTERMTABLE DBG::*DEBUGGER-TERMINAL-TABLE*)) (HANDLER-BIND ((XCL:STREAM-NOT -OPEN (FUNCTION (LAMBDA (COND) (IF (FMEMB (XCL:STREAM-NOT-OPEN-STREAM COND) (LIST OUTSTREAM *KEYBOARD-STREAM* (FULLNAME OUTSTREAM) (FULLNAME *KEYBOARD-STREAM*))) THEN (RESET) (* \; " abort") ELSE NIL (* \; "ignore")))))) (CHATSERVER)))) (SETQ \\SWEPT.OFDS (REMOVE OUTSTREAM \\SWEPT.OFDS)))) ) (UNIXCHATSERVER (LAMBDA NIL (* \; "Edited 11-Jun-90 16:07 by jrb:") (DEL.PROCESS (QUOTE UNIX.CHAT.LISTENER)) (ADD.PROCESS (BQUOTE (UNIX.CHAT.LISTENER (\\\, UNIX.CHAT.SOCKET))) (QUOTE RESTARTABLE) (QUOTE HARDRESET))) ) (UNIX.CHAT.LISTENER (LAMBDA (STREAMHANDLE) (* \; "Edited 1-Jul-90 17:41 by jrb:") (LET ((RUNNING T) (SOCKSTREAM (CREATE-UNIX-SOCKET-STREAM STREAMHANDLE))) (|if| (STREAMP SOCKSTREAM) |then| (|while| RUNNING |do| (BLOCK 1000) (LET ((NEWSTREAM (ACCEPT-UNIX-SOCKET-STREAM SOCKSTREAM))) (COND ((NULL NEWSTREAM) (CL:FORMAT PROMPTWINDOW "Accept on ~s lost badly; UNIX.CHAT.LISTENER dying" SOCKSTREAM) (SETQ RUNNING NIL) (* |;;| "spawn another listener") (ADD.PROCESS (BQUOTE (UNIX.CHAT.LISTENER (\\\, STREAMHANDLE))) (QUOTE RESTARTABLE) (QUOTE HARDRESET))) ((STREAMP NEWSTREAM) (* |;;| "ok, I'm the server") (PROCESS.NAME (THIS.PROCESS) (QUOTE CHATSERVER)) (PROCESSPROP (THIS.PROCESS) (QUOTE RESTARTABLE) NIL) (CLOSEF SOCKSTREAM) (* |;;| "spawn another listener") (ADD.PROCESS (BQUOTE (UNIX.CHAT.LISTENER (\\\, STREAMHANDLE))) (QUOTE RESTARTABLE) (QUOTE HARDRESET)) (PROCESSPROP (THIS.PROCESS) (QUOTE RESTARTABLE) NIL) (SETQ RUNNING NIL) (EMACSCHATSERVEROPENFN NEWSTREAM NEWSTREAM))))) |else| (ERROR "Coudn't open socket handle" STREAMHANDLE)))) ) ) (RPAQQ UNIX.CHAT.SOCKET "/tmp/Maiko-Socket0") (SETQ DISPLAYTERMFLG NIL) (* \; "EMACS doesn't grok DM2500 escapes") (SETQ EMACSCSTTBL (COPYTERMTABLE (QUOTE ORIG))) (* \; "EMACS wants no echoing and LF to mean accept input") (SETSYNTAX (CHARCODE LF) (QUOTE EOL) EMACSCSTTBL) (ECHOMODE NIL EMACSCSTTBL) (DECLARE\: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS (ADDTOVAR NLAMA) (ADDTOVAR NLAML) (ADDTOVAR LAMA EMACSCHATSERVEROPENFN) ) (PUTPROPS CHATSERVER-EMACS COPYRIGHT ("Venue" 1990)) (DECLARE\: DONTCOPY (FILEMAP (NIL (889 4536 (EMACSCHATSERVEROPENFN 899 . 3264) (UNIXCHATSERVER 3266 . 3487) ( UNIX.CHAT.LISTENER 3489 . 4534))))) STOP  TIMESROMAN >>zē