(FILECREATED "13-Dec-84 03:48:39" {ERIS}<LISPCORE>LIBRARY>MONSTERSCOPE.;13 12798 changes to: (VARS MONSTERSCOPECOMS) (FNS \REMOTE! ! \BOUNDNCHARSP) (RESOURCES \REMOTE!STREAM) previous date: "11-Dec-84 00:58:43" {ERIS}<LISPCORE>LIBRARY>MONSTERSCOPE.;8) (* Copyright (c) 1984 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT MONSTERSCOPECOMS) (RPAQQ MONSTERSCOPECOMS ((FILES (SYSLOAD FROM LISPUSERS) EVALSERVER) (COMS (* "Client side") (FNS ! \MONSTERSCOPE.PUPHANDLER \MONSTERSCOPE.ERRORHANDLER) (INITVARS (REMOTEMONSTER NIL)) (GLOBALVARS REMOTEMONSTER)) (COMS (* "Server side") (FNS \REMOTE! \SENDMONSTERESULTS \BOUNDNCHARSP) (DECLARE: EVAL@COMPILE DONTCOPY (RESOURCES \REMOTE!STREAM)) (INITRESOURCES \REMOTE!STREAM) (INITVARS (REMOTEMONSTER.DRIBBLEFLG T)) (GLOBALVARS REMOTEMONSTER.TTYWINDOW REMOTEMONSTER.DRIBBLEFLG)) (DECLARE: EVAL@COMPILE DONTCOPY (FILES (LOADCOMP) BSP)) (FILES (SYSLOAD) BSP) (DECLARE: DONTEVAL@LOAD DOCOPY (P (OR (WAKE.PROCESS (QUOTE EvalServerListening)) (EVALSERVER)))) (COMS (* "At one time, I tried using SPP instead of BSP") (DECLARE: DONTCOPY (FNS SPP! SPP\REMOTE! SPP\SENDMONSTERESULTS) (FILES (LOADCOMP) SPP))) (DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS (ADDVARS (NLAMA SPP! !) (NLAML SPP\SENDMONSTERESULTS SPP\REMOTE! \SENDMONSTERESULTS \REMOTE!) (LAMA))))) (FILESLOAD (SYSLOAD FROM LISPUSERS) EVALSERVER) (* "Client side") (DEFINEQ (! (NLAMBDA LINE (* JonL "13-Dec-84 00:35") (OR (FIXP REMOTEMONSTER) (SETQ REMOTEMONSTER (OR (FIXP (AND REMOTEMONSTER (LITATOM REMOTEMONSTER) (ETHERHOSTNUMBER REMOTEMONSTER))) (FIXP (ETHERHOSTNUMBER (MKATOM (PROMPTFORWORD "What is the PUP name or number of your RemoteMonsterscope server? " NIL NIL NIL NIL T)))) (HELP (QUOTE REMOTEMONSTER))))) (PROG ((ANS (REMOTEVAL (LIST (QUOTE \REMOTE!) LINE) REMOTEMONSTER)) (WR "WRONG RESULT")) (SELECTQ (CAR (LISTP ANS)) (OK (pop ANS)) (BSP (RESETLST (PROG ((PUPORT (CAR (LISTP (CDR ANS)))) BSPSOC STREAM) (if (AND (LISTP PUPORT) (FIXP (CAR PUPORT)) (FIXP (CDR PUPORT))) then (OR (SETQ BSPSOC (OPENRTPSOCKET PUPORT)) (ERROR PUPORT "Cant establish BSP connection")) (RESETSAVE NIL (LIST (QUOTE CLOSEPUPSOCKET) (fetch PUPSOC of BSPSOC) T)) (RESETSAVE (SETQ STREAM (OPENBSPSTREAM BSPSOC (FUNCTION \MONSTERSCOPE.PUPHANDLER) (FUNCTION \MONSTERSCOPE.ERRORHANDLER))) (QUOTE (PROGN (CLOSEBSPSTREAM OLDVALUE)))) (SETQ ANS (READ STREAM)) else (ERROR ANS WR))))) (ERROR ANS WR)) (OR (LISTP ANS) (ERROR ANS WR)) (SETQ WR (pop ANS)) (* First item in result list is a stringp of all the sideeffects) (if (AND (STRINGP WR) (ILESSP 0 (NCHARS WR))) then (LISPXPRIN1 WR)) (RETURN ANS)))) (\MONSTERSCOPE.PUPHANDLER (LAMBDA (PUP STREAM) (DECLARE (GLOBALVARS PUPTRACEFILE)) (* JonL "10-Dec-84 00:38") (if (AND (EQ \PT.ERROR (fetch PUPTYPE of PUP)) PUPTRACEFLG) then (PRINTERRORPUP PUP PUPTRACEFILE)))) (\MONSTERSCOPE.ERRORHANDLER (LAMBDA (STREAM ERRCODE) (* JonL "10-Dec-84 00:32") (SELECTQ ERRCODE (MARK.ENCOUNTERED (APPLY* (fetch ENDOFSTREAMOP of STREAM) STREAM)) NIL))) ) (RPAQ? REMOTEMONSTER NIL) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS REMOTEMONSTER) ) (* "Server side") (DEFINEQ (\REMOTE! (NLAMBDA (LINE) (* JonL "13-Dec-84 03:47") (* Remember that the stupid Monsterscope may print out some dots while "thinking") (if (GETD (QUOTE CREATEW)) then (TTYDISPLAYSTREAM (OR REMOTEMONSTER.TTYWINDOW (if (GETD CREATEW) then (SETQ REMOTEMONSTER.TTYWINDOW (CREATEW (CONSTANT (create REGION LEFT ← 200 BOTTOM ← 100 WIDTH ← 400 HEIGHT ← 200)) "TtyWindow for REMOTEMONSTER")) (WINDOWPROP REMOTEMONSTER.TTYWINDOW (QUOTE PAGEFULLFN) (QUOTE TRUE)) REMOTEMONSTER.TTYWINDOW else (SETQ REMOTEMONSTER.TTYWINDOW (DSPCREATE)))))) (WITH-RESOURCE \REMOTE!STREAM (LET (ANS PUPSOC) (RESETLST (RESETSAVE (OPENSTREAM \REMOTE!STREAM (QUOTE OUTPUT)) (QUOTE (PROGN (CLOSEF? OLDVALUE)))) (if REMOTEMONSTER.DRIBBLEFLG then (RESETSAVE NIL (LIST (QUOTE DRIBBLE) (DRIBBLE \REMOTE!STREAM)))) (SETQ ANS (EVAL (CONS (QUOTE %.) LINE))) (push ANS (LET (LEN) (if (AND REMOTEMONSTER.DRIBBLEFLG (NEQ 0 (PROG1 (SETQ LEN (GETFILEPTR \REMOTE!STREAM)) (DRIBBLE)))) then (* (DRIBBLE) should have closed the stream) (OPENSTREAM \REMOTE!STREAM (QUOTE INPUT)) (AIN (ALLOCSTRING LEN) 1 LEN \REMOTE!STREAM))))) (if (\BOUNDNCHARSP 500 ANS T) then (* Simple case when there aren't too many characters) (CONS (QUOTE OK) ANS) else (ADD.PROCESS (LIST (QUOTE \SENDMONSTERESULTS) (SETQ PUPSOC (OPENPUPSOCKET)) ANS)) (to 4 do (BLOCK)) (LIST (QUOTE BSP) (CONS (\LOCALPUPADDRESS) (PUPSOCKETNUMBER PUPSOC)))))))) (\SENDMONSTERESULTS (NLAMBDA (PUPSOC ANS) (* JonL "10-Dec-84 06:51") (RESETLST (RESETSAVE NIL (LIST (QUOTE CLOSEPUPSOCKET) PUPSOC T)) (PROG ((BSPSOC (OPENRTPSOCKET NIL (QUOTE SERVER) PUPSOC NIL 120000)) STREAM OUTSTREAM) (DECLARE (SPECVARS OUTSTREAM STREAM)) (SETQ STREAM (OPENBSPSTREAM BSPSOC (FUNCTION NILL) (FUNCTION NILL))) (SETQ OUTSTREAM (BSPOUTPUTSTREAM STREAM)) (RESETLST (forDuration 120 timerUnits (QUOTE SECONDS) when (PROGN (BLOCK) (BSPOPENP OUTSTREAM (QUOTE OUTPUT))) do (RETURN) finally (PROGN (CLOSEBSPSTREAM STREAM) (ERROR "Timed out"))) (\MAPCHARS (FUNCTION (LAMBDA (C) (DECLARE (USEDFREE OUTSTREAM)) (BOUT OUTSTREAM C))) ANS T) (CLOSEBSPSTREAM STREAM)))))) (\BOUNDNCHARSP (LAMBDA (N X FLG RDTBL) (DECLARE (SPECVARS N)) (* JonL "13-Dec-84 00:46") (\MAPCHARS (FUNCTION (LAMBDA (C) (if (IGREATERP 0 (add N -1)) then (RETFROM (QUOTE \BOUNDNCHARSP))))) X FLG RDTBL) T)) ) (DECLARE: EVAL@COMPILE DONTCOPY (DECLARE: EVAL@COMPILE (PUTDEF (QUOTE \REMOTE!STREAM) (QUOTE RESOURCES) (QUOTE (NEW (OPENSTREAM (QUOTE {NODIRCORE}) (QUOTE BOTH))))) ) ) (/SETTOPVAL (QUOTE \\REMOTE!STREAM.GLOBALRESOURCE)) (RPAQ? REMOTEMONSTER.DRIBBLEFLG T) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS REMOTEMONSTER.TTYWINDOW REMOTEMONSTER.DRIBBLEFLG) ) (DECLARE: EVAL@COMPILE DONTCOPY (FILESLOAD (LOADCOMP) BSP) ) (FILESLOAD (SYSLOAD) BSP) (DECLARE: DONTEVAL@LOAD DOCOPY (OR (WAKE.PROCESS (QUOTE EvalServerListening)) (EVALSERVER)) ) (* "At one time, I tried using SPP instead of BSP") (DECLARE: DONTCOPY (DEFINEQ (SPP! (NLAMBDA LINE (* JonL "10-Dec-84 00:03") (OR (FIXP REMOTEMONSTER) (PROG ((N (MKATOM (PROMPTFORWORD "What is the PUP name or number of your RemoteMonsterscope server? " NIL NIL NIL NIL T)))) (OR (AND N (FIXP (SETQ N (ETHERHOSTNUMBER N)))) (HELP (QUOTE REMOTEMONSTER))) (SETQ REMOTEMONSTER N))) (PROG ((ANS (REMOTEVAL (LIST (QUOTE SPP\REMOTE!) \MY.NSADDRESS LINE) REMOTEMONSTER)) (WR "WRONG RESULT") NSADD) (if (NLISTP ANS) then (ERROR ANS WR) elseif (EQ (CAR ANS) (QUOTE SPP!)) then (RETURN (CDR ANS)) elseif (AND (FIXP (CAR ANS)) (SETQ NSADD (CAR (LISTP (CDR ANS)))) (LITATOM NSADD)) then (* Must be the NSOCKET number) (PROG ((STREAM (SPP.OPEN NSADD (CAR ANS) T))) (forDuration 120 timerUnits (QUOTE SECONDS) when (PROGN (BLOCK) (SPP.READP STREAM)) do (RETURN) finally (PROGN (SPP.CLOSE STREAM) (ERROR "Timed out"))) (SETQ ANS (READ STREAM)) (SPP.CLOSE STREAM)) (RETURN ANS) else (ERROR ANS WR))))) (SPP\REMOTE! (NLAMBDA (NSADD LINE) (* JonL "10-Dec-84 05:18") (* Remember that the stupid Monsterscope will print out some dots while "thinking") (OR (WINDOWP REMOTEMONSTER.TTYWINDOW) (SETQ REMOTEMONSTER.TTYWINDOW (CREATEW (CONSTANT (create REGION LEFT ← 200 BOTTOM ← 100 WIDTH ← 400 HEIGHT ← 200)) "TtyWindow for REMOTEMONSTER"))) (TTYDISPLAYSTREAM REMOTEMONSTER.TTYWINDOW) (WITH-RESOURCE \REMOTE!STREAM (SETFILEPTR \REMOTE!STREAM 0) (PROG (ANS SKT LEN) (SETQ ANS (RESETLST (RESETSAVE (OUTPUT \REMOTE!STREAM)) (EVAL (CONS (QUOTE %.) LINE)))) (push ANS (if (NEQ 0 (SETQ LEN (GETFILEPTR \REMOTE!STREAM))) then (PROG1 (AIN (ALLOCSTRING LEN) 1 LEN \REMOTE!STREAM) (SETFILEPTR \REMOTE!STREAM 0)) else "")) (RETURN (if (ILESSP (NCHARS ANS) 500) then (* Simple case when there aren't too many characters) (CONS (QUOTE OK) ANS) else (ADD.PROCESS (LIST (QUOTE SPP\SENDMONSTERESULTS) NSADD (SETQ SKT (OPENNSOCKET)) ANS)) (to 10 do (BLOCK)) (LIST (NSOCKETNUMBER SKT) \MY.NSADDRESS))))))) (SPP\SENDMONSTERESULTS (NLAMBDA (NSADD SKT ANS) (* JonL " 9-Dec-84 16:43") (PROG (SPPCON (STREAM (SPP.OPEN NIL SKT))) (DECLARE (SPECVARS STREAM)) (SETQ SPPCON (fetch SPP.CONNECTION of STREAM)) (forDuration 120 timerUnits (QUOTE SECONDS) when (PROGN (BLOCK) (fetch SPPESTABLISHEDP of SPPCON)) do (RETURN) finally (PROGN (SPP.CLOSE STREAM) (ERROR "Timed out"))) (\MAPCHARS (FUNCTION (LAMBDA (C) (DECLARE (USEDFREE STREAM)) (BOUT STREAM C))) ANS T) (SPP.SENDEOM STREAM) (forDuration 120 timerUnits (QUOTE SECONDS) do (BLOCK) (if (fetch SPPTERMINATEDP of SPPCON) then (RETURN))) (SPP.CLOSE STREAM) (CLOSENSOCKET SKT T)))) ) (FILESLOAD (LOADCOMP) SPP) ) (DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS (ADDTOVAR NLAMA SPP! !) (ADDTOVAR NLAML SPP\SENDMONSTERESULTS SPP\REMOTE! \SENDMONSTERESULTS \REMOTE!) (ADDTOVAR LAMA ) ) (PUTPROPS MONSTERSCOPE COPYRIGHT ("Xerox Corporation" 1984)) (DECLARE: DONTCOPY (FILEMAP (NIL (1648 4144 (! 1658 . 3589) (\MONSTERSCOPE.PUPHANDLER 3591 . 3883) ( \MONSTERSCOPE.ERRORHANDLER 3885 . 4142)) (4266 7860 (\REMOTE! 4276 . 6525) (\SENDMONSTERESULTS 6527 . 7531) (\BOUNDNCHARSP 7533 . 7858)) (8504 12482 (SPP! 8514 . 9965) (SPP\REMOTE! 9967 . 11514) ( SPP\SENDMONSTERESULTS 11516 . 12480))))) STOP