(FILECREATED "16-Sep-84 22:08:03" {ERIS}<LISPCORE>SOURCES>DMISC.;17 38849 changes to: (VARS DMISCCOMS) (FNS \WRITEPRINTERPORT.UFN \READPRINTERPORT.UFN) previous date: "13-Sep-84 13:43:04" {ERIS}<LISPCORE>SOURCES>DMISC.;16) (* Copyright (c) 1982, 1983, 1984 by Xerox Corporation. All rights reserved. The following program was created in 1982 but has not been published within the meaning of the copyright law, is furnished under license, and may not be used, copied and/or disclosed except in accordance with the terms of said license.) (PRETTYCOMPRINT DMISCCOMS) (RPAQQ DMISCCOMS [(COMS (FNS TENEX)) [COMS (FNS BACKSPACEDEL) (DECLARE: DOCOPY DONTEVAL@LOAD (P (BACKSPACEDEL \ORIGTERMTABLE) (BACKSPACEDEL NIL] (COMS (* timeall functions) (FNS TIMEALL COPYMISCSTATS COPYTIMESTATS CREATEMISCSTATS DIFFMISCSTATS DIFFTIMESTATS PRINTMISCSTATS PRINTMISCSTATSITEM) (DECLARE: DONTCOPY (RECORDS STATSOBJECT))) [COMS (FNS PERIODICALLYRECLAIM) (DECLARE: DONTEVAL@LOAD DOCOPY [INITVARS (RECLAIMWAIT 4) (\LASTRECLAIM (\DAYTIME0 (NCREATE (QUOTE FIXP] (APPENDVARS (BACKGROUNDFNS PERIODICALLYRECLAIM] (FNS APROPOS \APROPOS.MARGINSET) (COMS (FNS \DIRTYBACKGROUND \SAVEVMBACKGROUND COPYVM) (INITVARS (BACKGROUNDPAGEMIN 40) (BACKGROUNDPAGECNT 0) (BACKGROUNDPAGEFREQ 4)) (INITVARS (SAVINGCURSOR) (SAVEVMMAX 600) (SAVEVMWAIT 300)) (ADDVARS (BACKGROUNDFNS \DIRTYBACKGROUND) (TTYBACKGROUNDFNS \SAVEVMBACKGROUND)) (GLOBALVARS BACKGROUNDPAGEMIN BACKGROUNDPAGEFREQ BACKGROUNDPAGECNT)) (COMS (* Setting the time) (FNS SETTIME)) [COMS (* Bells and whistles) (FNS RINGBELLS FLASHWINDOW \DISMISS.WITHOUT.BLOCKING PLAYTUNE) (GLOBALRESOURCES \PlayTimer) (DECLARE: DONTEVAL@LOAD DOCOPY (* Overrides definition in the shared MISC) (P (MOVD (QUOTE RINGBELLS) (QUOTE PRINTBELLS] (COMS (* These are optimizations for Interlisp-D only) (FNS ATOMHASH#PROBES \ATOM.FIRSTHASHINDEX)) [COMS (* functions for turning the display off.) (FNS DISPLAYDOWN SETDISPLAYHEIGHT VIDEORATE) (INITVARS (\VIDEORATE (QUOTE NORMAL))) (DECLARE: DONTEVAL@LOAD DOCOPY (ADDVARS (BREAKRESETFORMS (SETDISPLAYHEIGHT T)) (RESETFORMS (SETDISPLAYHEIGHT T] (DECLARE: DONTEVAL@LOAD DOCOPY (VARS (#EOLCHARS 1)) [P (OR (LISTP (EVALV (QUOTE EDITCHARACTERS))) (RPAQ EDITCHARACTERS (QUOTE (J X Z Y N] (ADDVARS (POSTGREETFORMS (CNDIR)) (LISPUSERSDIRECTORIES))) [COMS (PROP VARTYPE BAKTRACELST) (ALISTS (BREAKMACROS BT BTV BTVPP BT!) (BAKTRACELST EVAL APPLY)) (DECLARE: DONTEVAL@LOAD DOCOPY (INITVARS (CLEANUPOPTIONS (QUOTE (RC] (COMS (FNS DOAROUNDEXITFORMS) (ADDVARS (AROUNDEXITFNS DOAROUNDEXITFORMS) (BEFORELOGOUTFORMS) (AFTERLOGOUTFORMS))) (DECLARE: DONTEVAL@LOAD DOCOPY (INITVARS (ADVISEDFNS))) [COMS (* from FASTARRAYS) (FNS POINTERARRAY WORDARRAY FIXPARRAY) (P (MAPC (QUOTE ((ELT FASTELT FASTELTN FASTELTW) (SETA FASTSETA FASTSETAN FASTSETAW) (GETHASH IGETHASH) (PUTHASH IPUTHASH))) (FUNCTION (LAMBDA (X) (MAPC (CDR X) (FUNCTION (LAMBDA (Y) (MOVD? (CAR X) Y] (COMS (* Versions etc) (FNS REALMEMORYSIZE LISPVERSION MICROCODEVERSION BCPLVERSION REQUIREVERSION)) (COMS (* Misc ops) (FNS READPRINTERPORT WRITEPRINTERPORT \READPRINTERPORT.UFN \WRITEPRINTERPORT.UFN \MISC1.UFN \MISC2.UFN)) (LOCALVARS . T) (DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS (ADDVARS (NLAMA) (NLAML TIMEALL) (LAMA]) (DEFINEQ (TENEX [LAMBDA (STR) (* lmm "29-APR-81 10:40") (RESETLST (PROG (REM.CM) (SETQ REM.CM (OPENFILE (QUOTE {DSK}REM.CM;1) (QUOTE OUTPUT))) (RESETSAVE NIL (LIST [FUNCTION (LAMBDA (X) (AND RESETSTATE (PROGN (CLOSEF? X) (CLOSEF (OPENFILE X (QUOTE OUTPUT] REM.CM)) (PRIN3 STR REM.CM) (PRIN3 " LISP.run " REM.CM) (CLOSEF REM.CM) (LOGOUT]) ) (DEFINEQ (BACKSPACEDEL [LAMBDA (TTBL) (* lmm "24-JUN-80 23:16") (* Hack for causing char-delete to backspace display. Also suppress ## when reach the left margin. - This should be executed after the chardelete in TTBL has been established. - ERASECHARCODE is in INITCONSTANTS on LLPARAMS) (DELETECONTROL (QUOTE 1STCHDEL) (CHARACTER ERASECHARCODE) TTBL) (DELETECONTROL (QUOTE NTHCHDEL) (CHARACTER ERASECHARCODE) TTBL) (DELETECONTROL (QUOTE POSTCHDEL) "" TTBL) (DELETECONTROL (QUOTE EMPTYCHDEL) "" TTBL) (DELETECONTROL (QUOTE NOECHO) NIL TTBL) (ECHOCONTROL ERASECHARCODE (QUOTE REAL]) ) (DECLARE: DOCOPY DONTEVAL@LOAD (BACKSPACEDEL \ORIGTERMTABLE) (BACKSPACEDEL NIL) ) (* timeall functions) (DEFINEQ (TIMEALL [NLAMBDA (TIMEFORM NUMBEROFTIMES TIMEWHAT INTERPFLG SHOWCODE) (* lmm "14-Aug-84 18:03") (* collects and prints stats on TIMEFORM. TIMEWHAT indicates what to collect stats on: if T, all of the system times are collected; if NIL, the system times plus all data allocations are kept; if a list, it should be a list of DATATYPES (or numbers) and may include the atom TIME if system times should be included. This function sets the variables BEFORESTATS, AFTERSTATS and DIFFERENCESTATS to the values of the stats objects before, after and the difference between them. These can be examined via the function PRINTMISCSTATS.) (DECLARE (GLOBALVARS BEFORESTATS AFTERSTATS DIFFERENCESTATS DFNFLG OPTIMIZATIONSOFF) (SPECVARS LCFIL STRF LAPFLG)) (PROG [VALUE (TIMEFLG (OR (NULL TIMEWHAT) (EQ TIMEWHAT T) (MEMB (QUOTE TIME) TIMEWHAT))) (DATATYPES (COND ((NULL TIMEWHAT) (DATATYPES)) ((EQ TIMEWHAT T) NIL) (T (for X inside TIMEWHAT bind NAME join (COND ((SETQ NAME (DATATYPEP X)) (CONS NAME)) ((EQ X (QUOTE TIME)) NIL) (T (printout T X " is not a datatype." T) NIL] (* create all necessary storage before performing test form.) (OR (NUMBERP NUMBEROFTIMES) (SETQ NUMBEROFTIMES 1)) [COND ([OR (NLISTP AFTERSTATS) (NOT (EQUAL DATATYPES (fetch DATATYPES of AFTERSTATS] (SETQ DIFFERENCESTATS (CREATEMISCSTATS DATATYPES TIMEFLG)) (SETQ BEFORESTATS (CREATEMISCSTATS DATATYPES TIMEFLG)) (SETQ AFTERSTATS (CREATEMISCSTATS DATATYPES TIMEFLG] [COND [(OR INTERPFLG (EQ NUMBEROFTIMES 1)) (COPYMISCSTATS BEFORESTATS DATATYPES) (SETQ VALUE (FRPTQ NUMBEROFTIMES (EVAL TIMEFORM] (T [RESETVARS ((DFNFLG T)) (PROG ((STRF T) (LCFIL) (LAPFLG SHOWCODE)) (COMPILE1 (QUOTE TIMEDUMMYFUNCTION) (LIST (QUOTE LAMBDA) NIL (LIST (QUOTE FRPTQ) NUMBEROFTIMES TIMEFORM] (COPYMISCSTATS BEFORESTATS DATATYPES) (SETQ VALUE (TIMEDUMMYFUNCTION] (COPYMISCSTATS AFTERSTATS DATATYPES T) (PRINTMISCSTATS (DIFFMISCSTATS BEFORESTATS AFTERSTATS DIFFERENCESTATS) DATATYPES) (RETURN VALUE]) (COPYMISCSTATS [LAMBDA (STATS DATATYPES BEFOREFLG) (* bvm: "28-MAR-82 22:00") (* smashes the fields of STATS to be the current values of stats in the system. BEFOREFLG indicates whether elapsed time should be taken before or after the bulk of the work.) (DECLARE (GLOBALVARS \MISCSTATS)) [COND (BEFOREFLG (CLOCK0 (fetch ELAPSEDTIME of STATS)) (for TYPE in DATATYPES as X on (fetch DATACOUNTERS of STATS) do (RPLACA X (BOXCOUNT TYPE] (AND (fetch TIMEBLOCK of STATS) (COPYTIMESTATS \MISCSTATS (fetch TIMEBLOCK of STATS))) (COND ((NOT BEFOREFLG) (for TYPE in DATATYPES as X on (fetch DATACOUNTERS of STATS) do (RPLACA X (BOXCOUNT TYPE))) (CLOCK0 (fetch ELAPSEDTIME of STATS]) (COPYTIMESTATS [LAMBDA (REFSTATS STATS) (* lmm " 7-Jun-84 16:49") (replace SWAPWAITTIME of STATS with (fetch SWAPWAITTIME of REFSTATS)) (replace KEYBOARDWAITTIME of STATS with (fetch KEYBOARDWAITTIME of REFSTATS)) (replace GCTIME of STATS with (fetch GCTIME of REFSTATS)) (replace PAGEFAULTS of STATS with (fetch PAGEFAULTS of REFSTATS)) (replace SWAPWRITES of STATS with (fetch SWAPWRITES of REFSTATS)) (replace TOTALTIME of STATS with (fetch TOTALTIME of REFSTATS)) (replace STARTTIME of STATS with (fetch STARTTIME of REFSTATS)) (replace DISKIOTIME of STATS with (fetch DISKIOTIME of REFSTATS)) (replace NETIOTIME of STATS with (fetch NETIOTIME of REFSTATS)) (replace DISKIOOPS of STATS with (fetch DISKIOOPS of REFSTATS)) (replace NETIOOPS of STATS with (fetch NETIOOPS of REFSTATS]) (CREATEMISCSTATS [LAMBDA (DATATYPES TIMEBLOCKFLG) (* bvm: " 6-OCT-82 15:28") (* creates a stats object for the types datatypes.) (create STATSOBJECT ELAPSEDTIME ←(CLOCK 0) TIMEBLOCK ←(AND TIMEBLOCKFLG (create MISCSTATS)) DATACOUNTERS ←(APPEND DATATYPES) DATATYPES ← DATATYPES]) (DIFFMISCSTATS [LAMBDA (BEFORE AFTER DIFFERENCES) (* bvm: " 6-OCT-82 15:30") (* puts the differences between two stats objects in a third stats object.) [for D on (fetch DATACOUNTERS of DIFFERENCES) as B in (fetch DATACOUNTERS of BEFORE) as A in (fetch DATACOUNTERS of AFTER) as TYPE in (fetch DATATYPES of DIFFERENCES) bind (LARGECNT ← 0) LARGECNTTAIL do (COND ((EQ TYPE (QUOTE FIXP)) (SETQ LARGECNTTAIL D))) (OR (SMALLP (COND (LARGECNTTAIL B) (T A))) (add LARGECNT 2)) (* The BOXCOUNT in COPYMISCSTATS for this datatype came out large, and thus did 2 number boxes (one to fetch main count, one to add in aux cnt), counted in the stats period) (FRPLACA D (IDIFFERENCE A B)) finally (COND ((AND (IGREATERP LARGECNT 0) LARGECNTTAIL) (* Adjust FIXP count to take into account all BOXCOUNT's that used up largep's) (FRPLACA LARGECNTTAIL (IDIFFERENCE (CAR LARGECNTTAIL) LARGECNT] (replace ELAPSEDTIME of DIFFERENCES with (IDIFFERENCE (fetch ELAPSEDTIME of AFTER) (fetch ELAPSEDTIME of BEFORE))) (AND (fetch TIMEBLOCK of BEFORE) (fetch TIMEBLOCK of AFTER) (fetch TIMEBLOCK of DIFFERENCES) (DIFFTIMESTATS (fetch TIMEBLOCK of BEFORE) (fetch TIMEBLOCK of AFTER) (fetch TIMEBLOCK of DIFFERENCES))) DIFFERENCES]) (DIFFTIMESTATS [LAMBDA (BEFOREBLOCK AFTERBLOCK DIFFERENCESBLOCK) (* bvm: "28-MAR-82 21:58") (* copies the difference between two stats blocks into a third stats block.) (replace SWAPWAITTIME of DIFFERENCESBLOCK with (IDIFFERENCE (fetch SWAPWAITTIME of AFTERBLOCK) (fetch SWAPWAITTIME of BEFOREBLOCK))) (replace KEYBOARDWAITTIME of DIFFERENCESBLOCK with (IDIFFERENCE (fetch KEYBOARDWAITTIME of AFTERBLOCK) (fetch KEYBOARDWAITTIME of BEFOREBLOCK))) (replace GCTIME of DIFFERENCESBLOCK with (IDIFFERENCE (fetch GCTIME of AFTERBLOCK) (fetch GCTIME of BEFOREBLOCK))) (replace PAGEFAULTS of DIFFERENCESBLOCK with (IDIFFERENCE (fetch PAGEFAULTS of AFTERBLOCK) (fetch PAGEFAULTS of BEFOREBLOCK))) (replace SWAPWRITES of DIFFERENCESBLOCK with (IDIFFERENCE (fetch SWAPWRITES of AFTERBLOCK) (fetch SWAPWRITES of BEFOREBLOCK))) (replace TOTALTIME of DIFFERENCESBLOCK with (IDIFFERENCE (fetch TOTALTIME of AFTERBLOCK) (fetch TOTALTIME of BEFOREBLOCK))) (replace STARTTIME of DIFFERENCESBLOCK with (IDIFFERENCE (fetch STARTTIME of AFTERBLOCK) (fetch STARTTIME of BEFOREBLOCK))) (replace DISKIOTIME of DIFFERENCESBLOCK with (IDIFFERENCE (fetch DISKIOTIME of AFTERBLOCK) (fetch DISKIOTIME of BEFOREBLOCK))) (replace NETIOTIME of DIFFERENCESBLOCK with (IDIFFERENCE (fetch NETIOTIME of AFTERBLOCK) (fetch NETIOTIME of BEFOREBLOCK))) (replace DISKIOOPS of DIFFERENCESBLOCK with (IDIFFERENCE (fetch DISKIOOPS of AFTERBLOCK) (fetch DISKIOOPS of BEFOREBLOCK))) (replace NETIOOPS of DIFFERENCESBLOCK with (IDIFFERENCE (fetch NETIOOPS of AFTERBLOCK) (fetch NETIOOPS of BEFOREBLOCK))) DIFFERENCESBLOCK]) (PRINTMISCSTATS [LAMBDA (STATS DATATYPES) (* bvm: " 6-JAN-83 18:13") (* prints the fields of MISCSTATS) [PROG ((CPUTIME (fetch ELAPSEDTIME of STATS))) (PRINTMISCSTATSITEM "Elapsed Time" CPUTIME T) (COND ((fetch TIMEBLOCK of STATS) (* printout time stats) (PROG ((STATSBLOCK (fetch TIMEBLOCK of STATS)) MSECS) [SETQ CPUTIME (IDIFFERENCE CPUTIME (SETQ MSECS (fetch SWAPWAITTIME of STATSBLOCK] (PRINTMISCSTATSITEM "SWAP time" MSECS T) [SETQ CPUTIME (IDIFFERENCE CPUTIME (SETQ MSECS (fetch KEYBOARDWAITTIME of STATSBLOCK] (PRINTMISCSTATSITEM "KEYWAIT time" MSECS T) [SETQ CPUTIME (IDIFFERENCE CPUTIME (SETQ MSECS (fetch GCTIME of STATSBLOCK] (PRINTMISCSTATSITEM "GC time" MSECS T) [SETQ CPUTIME (IDIFFERENCE CPUTIME (SETQ MSECS (fetch DISKIOTIME of STATSBLOCK] (PRINTMISCSTATSITEM "Disk i/o time" MSECS T) (PRINTMISCSTATSITEM "CPU Time" CPUTIME T) (PRINTMISCSTATSITEM (QUOTE PAGEFAULTS) (fetch PAGEFAULTS of STATSBLOCK)) (PRINTMISCSTATSITEM (QUOTE SWAPWRITES) (fetch SWAPWRITES of STATSBLOCK)) (PRINTMISCSTATSITEM (QUOTE DISKOPS) (fetch DISKOPS of STATSBLOCK)) (PRINTMISCSTATSITEM (QUOTE NETIOTIME) (fetch NETIOTIME of STATSBLOCK) T) (PRINTMISCSTATSITEM (QUOTE NETIOOPS) (fetch NETIOOPS of STATSBLOCK] (* construct a list of the elements that will fit on one line.) (bind PRINTABLES RESULT COL←0 (LINELENGTH ←(LINELENGTH)) for DT in DATATYPES as DIF in (fetch DATACOUNTERS of STATS) unless (EQ DIF 0) do [COND ((IGREATERP (SETQ COL (IPLUS COL (NCHARS DT))) LINELENGTH) (* line break) (SETQ PRINTABLES (NCONC1 PRINTABLES (DREVERSE RESULT))) (SETQ RESULT) (SETQ COL (NCHARS DT] (SETQ RESULT (CONS (CONS (add COL 1) (CONS DT DIF)) RESULT)) finally [COND (RESULT (SETQ PRINTABLES (NCONC1 PRINTABLES (DREVERSE RESULT] (for LINE in PRINTABLES do (for PR in LINE do (LISPXPRIN1 (CADR PR) T) (* Print datatype names) (LISPXTAB (CAR PR) NIL T)) (LISPXTERPRI T) (for PR in LINE do (LISPXPRIN2 (CDDR PR) T) (* Print amount used) (LISPXTAB (CAR PR) NIL T)) (LISPXTERPRI T]) (PRINTMISCSTATSITEM [LAMBDA (STR NUM TIMEFLG) (* bvm: "26-MAR-82 16:25") (COND ((NOT (EQP NUM 0)) (LISPXPRIN1 STR T) (LISPXPRIN1 " = ") (COND (TIMEFLG (LISPXTAB 16 0 T) (PRINTNUM (QUOTE (FLOAT 9 NIL NIL NIL 3)) (SETQ NUM (FQUOTIENT NUM 1000.0)) T) (* 3 significant digits) (LISPXPRIN2 NUM T T T) (* Record on history without printing) (LISPXPRIN1 " seconds" T)) (T (LISPXPRIN2 NUM T))) (LISPXTERPRI T]) ) (DECLARE: DONTCOPY [DECLARE: EVAL@COMPILE (RECORD STATSOBJECT (ELAPSEDTIME TIMEBLOCK DATACOUNTERS . DATATYPES)) ] ) (DEFINEQ (PERIODICALLYRECLAIM [LAMBDA NIL (* bvm: "21-JUL-83 16:49") (DECLARE (GLOBALVARS \RECLAIM.COUNTDOWN \LASTUSERACTION RECLAIMWAIT \LASTRECLAIM)) (PROG (LU) (if (AND \RECLAIM.COUNTDOWN (\SECONDSCLOCKGREATERP \LASTUSERACTION RECLAIMWAIT) (\SECONDSCLOCKGREATERP \LASTRECLAIM RECLAIMWAIT)) then (RECLAIM) (\DAYTIME0 \LASTRECLAIM]) ) (DECLARE: DONTEVAL@LOAD DOCOPY (RPAQ? RECLAIMWAIT 4) (RPAQ? \LASTRECLAIM (\DAYTIME0 (NCREATE (QUOTE FIXP)))) (APPENDTOVAR BACKGROUNDFNS PERIODICALLYRECLAIM) ) (DEFINEQ (APROPOS [LAMBDA (STRING ALLFLG QUIETFLG) (* JonL " 7-May-84 01:31") (PROG ((FILTERFN (AND ALLFLG (NEQ ALLFLG T) (FNTYP ALLFLG) ALLFLG)) (DISPLAYSTREAM (DISPLAYSTREAMP (\OUTSTREAMARG T))) (BLOCKCOUNT 1) RESULT) (DECLARE (SPECVARS RESULT FILTERFN DISPLAYSTREAM)) [RESETFORM (PRINTLEVEL 3 5) (MAPATOMS (FUNCTION (LAMBDA (ATOM) (PROG (VAL PROPL MARGSET) (DECLARE (USEDFREE RESULT FILTERFN)) (COND ((EQ 0 (IMOD (add BLOCKCOUNT 1) 32)) (SETQ BLOCKCOUNT 1) (BLOCK))) (COND ([COND (FILTERFN (AND (STRPOS STRING ATOM) (APPLY* FILTERFN ATOM))) (T (AND (OR ALLFLG (GETD ATOM) (GETPROPLIST ATOM) (NEQ (GETTOPVAL ATOM) (QUOTE NOBIND))) (STRPOS STRING ATOM) (OR ALLFLG (AND (NOT (GENSYM? ATOM)) (NEQ (CHCON1 ATOM) (CHARCODE \)) (NOT (\SUBFNDEF ATOM] (COND (QUIETFLG (push RESULT ATOM)) (T (PRIN2 ATOM T) (SPACES 1 T) (SETQ PROPL (GETPROPLIST ATOM)) [COND ((OR (NEQ (GETTOPVAL ATOM) (QUOTE NOBIND)) PROPL (GETD ATOM)) [COND ((GETD ATOM) (TAB 16 NIL T) (PRIN1 "- " T) (OR (NULL DISPLAYSTREAM) (SETQ MARGSET (DSPXPOSITION NIL DISPLAYSTREAM))) (PRIN1 "Function arglist: " T) (COND [DISPLAYSTREAM (RESETFORM (\APROPOS.MARGINSET MARGSET DISPLAYSTREAM) (PRIN2 (ARGLIST ATOM] (T (PRIN2 (ARGLIST ATOM] [COND ((NEQ (SETQ VAL (GETTOPVAL ATOM)) (QUOTE NOBIND)) (TAB 16 NIL T) (PRIN1 "- " T) (OR (NULL DISPLAYSTREAM) MARGSET (SETQ MARGSET (DSPXPOSITION NIL DISPLAYSTREAM))) (PRIN1 "Variable value: " T) (COND (DISPLAYSTREAM (RESETFORM ( \APROPOS.MARGINSET MARGSET DISPLAYSTREAM) (PRIN2 VAL))) (T (PRIN2 VAL] (COND ((SETQ VAL (GETPROPLIST ATOM)) (TAB 16 NIL T) (PRIN1 "- " T) (OR (NULL DISPLAYSTREAM) MARGSET (SETQ MARGSET (DSPXPOSITION NIL DISPLAYSTREAM))) (PRIN1 "Property list: " T) (COND (DISPLAYSTREAM (RESETFORM ( \APROPOS.MARGINSET MARGSET DISPLAYSTREAM) (PRIN2 VAL))) (T (PRIN2 VAL] (TERPRI T] (RETURN RESULT]) (\APROPOS.MARGINSET [LAMBDA (X DISPLAYSTREAM) (if (AND (LISTP X) (NULL DISPLAYSTREAM)) then (SETQ DISPLAYSTREAM (CADR X)) (SETQ X (CAR X))) (LIST (DSPLEFTMARGIN X DISPLAYSTREAM) DISPLAYSTREAM]) ) (DEFINEQ (\DIRTYBACKGROUND [LAMBDA NIL (* lmm "14-AUG-83 16:08") (DECLARE (GLOBALVARS SAVEVMMAX \LASTUSERACTION SAVEVMWAIT SAVINGCURSOR \DIRTYPAGEHINT)) (COND ((AND BACKGROUNDPAGEFREQ (ILEQ (add BACKGROUNDPAGECNT -1) 0)) (\WRITEDIRTYPAGE BACKGROUNDPAGEMIN) (SETQ BACKGROUNDPAGECNT BACKGROUNDPAGEFREQ]) (\SAVEVMBACKGROUND [LAMBDA NIL (* bvm: " 7-Dec-83 15:22") (COND ((AND (ILESSP \DIRTYPAGEHINT SAVEVMMAX) (NEQ (fetch (IFPAGE Key) of \InterfacePage) \IFPValidKey) (FIXP SAVEVMWAIT) (\SECONDSCLOCKGREATERP \LASTUSERACTION SAVEVMWAIT)) (COND ((ILESSP (SETQ \DIRTYPAGEHINT (\COUNTREALPAGES (QUOTE DIRTY))) SAVEVMMAX) (* Recalculate the hint before deciding it's okay) (RESETLST (AND SAVINGCURSOR (GETD (QUOTE CURSOR)) (RESETSAVE (CURSOR SAVINGCURSOR))) (SAVEVM]) (COPYVM [LAMBDA (FILE) (* bvm: "12-Jan-84 12:07") (DECLARE (GLOBALVARS \VMEM.INHIBIT.WRITE)) (RESETVARS ((\VMEM.INHIBIT.WRITE T)) (RETURN (COND ((EQ (fetch (IFPAGE Key) of \InterfacePage) \IFPValidKey) (\COPYSYS FILE NIL T)) (T "Can't--virtual memory has been written to"]) ) (RPAQ? BACKGROUNDPAGEMIN 40) (RPAQ? BACKGROUNDPAGECNT 0) (RPAQ? BACKGROUNDPAGEFREQ 4) (RPAQ? SAVINGCURSOR ) (RPAQ? SAVEVMMAX 600) (RPAQ? SAVEVMWAIT 300) (ADDTOVAR BACKGROUNDFNS \DIRTYBACKGROUND) (ADDTOVAR TTYBACKGROUNDFNS \SAVEVMBACKGROUND) (DECLARE: DOEVAL@COMPILE DONTCOPY (GLOBALVARS BACKGROUNDPAGEMIN BACKGROUNDPAGEFREQ BACKGROUNDPAGECNT) ) (* Setting the time) (DEFINEQ (SETTIME [LAMBDA (DT) (* bvm: "26-Jul-84 15:32") (if (OR (AND (NULL DT) (\NET.SETTIME)) (PROG [(IDT (AND DT (LISP.TO.ALTO.DATE (OR (IDATE DT) (ERROR "Invalid date" DT] RETRY [COND ((NOT IDT) (printout T "Enter date and time as string in double quotes: ") (COND ([SETQ IDT (IDATE (OR (SETQ DT (READ T T)) (RETURN "time not set"] (SETQ IDT (LISP.TO.ALTO.DATE IDT))) (T (printout T "Sorry, couldn't parse that" T) (GO RETRY] (\SETDAYTIME0 (COND ((SMALLP IDT) (create FIXP HINUM ← 0 LONUM ← IDT)) (T IDT))) (RETURN T))) then (DATE (DATEFORMAT TIME.ZONE]) ) (* Bells and whistles) (DEFINEQ (RINGBELLS (LAMBDA (N) (* JonL "18-Feb-84 10:02") (OR (FIXP N) (SETQ N 1)) (SELECTQ (MACHINETYPE) (DANDELION (PROG ((L1 (QUOTE ((1000 . 1000) (800 . 1000) (600 . 1000) (500 . 1000) (400 . 1000) (NIL . 500) (440 . 1000) (484 . 1000) (540 . 1000) (600 . 1000)))) (L2 (QUOTE ((2000 . 1000) (1600 . 1000) (1200 . 1000) (1000 . 1000) (800 . 1000) (NIL . 500) (880 . 1000) (968 . 1000) (1080 . 1000) (1188 . 1000))))) (to N do (PLAYTUNE L1) (FLASHWINDOW NIL NIL 100) (PLAYTUNE L2)))) (FLASHWINDOW NIL N)))) (FLASHWINDOW [LAMBDA (WIN? N FLASHINTERVAL SHADE) (* lmm "14-Aug-84 18:23") (* This is an "attention getting" action.) (* rrb - added shade argument so contrast of flash could be explored.) (OR (FIXP N) (SETQ N 1)) (OR (FIXP FLASHINTERVAL) (SETQ FLASHINTERVAL 200)) [COND ((WINDOWP WIN?) (SETQ WIN? (GETSTREAM WIN? (QUOTE OUTPUT] (GLOBALRESOURCE (\PlayTimer) (for I to N bind (WHOLEP ← (NOT (DISPLAYSTREAMP WIN?))) COLORP first [COND (WHOLEP (SETQ COLORP (NULL (VIDEOCOLOR] do (UNINTERRUPTABLY (* Open-coded "during" loops so that no one else can sneak in and steal cycles) (COND [WHOLEP (* Flash the whole screen) (VIDEOCOLOR (PROG1 (VIDEOCOLOR COLORP) (\DISMISS.WITHOUT.BLOCKING FLASHINTERVAL \PlayTimer] (T (* Although VIDEOCOLOR is nearly instantaneous, INVERTW may require a time approaching the interval time and thus this path could be much longer) (INVERTW WIN? SHADE) (\DISMISS.WITHOUT.BLOCKING FLASHINTERVAL \PlayTimer) (INVERTW WIN? SHADE)))) (COND ((NEQ I N) (BLOCK 250]) (\DISMISS.WITHOUT.BLOCKING (LAMBDA (DURATION TIMER? timerUnits) (* JonL "18-Feb-84 09:48") ((LAMBDA (\DurationLimit) (DECLARE (LOCALVARS \DurationLimit)) (until (TIMEREXPIRED? \DurationLimit timerUnits) do NIL)) (SETUPTIMER DURATION TIMER? timerUnits)))) (PLAYTUNE (LAMBDA (Frequency/Duration.pairlist) (* JonL "22-SEP-83 15:25") (* Frequency/Duration.pairlist is a list of Frequency/Duration pairs. The durations are in TICKS which means that a "tune" must be re-scaled between the DLion and the other machines.) (RESETLST (RESETSAVE NIL (QUOTE (BEEPOFF))) (GLOBALRESOURCE (\PlayTimer) (for X in Frequency/Duration.pairlist do (if (CAR X) then (BEEPON (CAR X)) else (BEEPOFF)) (forDuration (CDR X) timerUnits (QUOTE TICKS) usingTimer \PlayTimer do (* Just "busy-wait" to pass the time) NIL)))) T)) ) (DECLARE: DONTCOPY (DECLARE: EVAL@COMPILE [PUTDEF (QUOTE \PlayTimer) (QUOTE RESOURCES) (QUOTE (NEW (SETUPTIMER 0] ) ) (/SETTOPVAL (QUOTE \\PlayTimer.GLOBALRESOURCE)) (DECLARE: DONTEVAL@LOAD DOCOPY (MOVD (QUOTE RINGBELLS) (QUOTE PRINTBELLS)) ) (* These are optimizations for Interlisp-D only) (DEFINEQ (ATOMHASH#PROBES (LAMBDA (STRING) (* JonL " 7-May-84 01:32") (PROG (BASE OFFST LEN HINDEX) (if (LITATOM STRING) then (SETQ BASE (fetch (LITATOM PNAMEBASE) of STRING)) (SETQ OFFST 1) (SETQ LEN (fetch (LITATOM PNAMELENGTH) of STRING)) else (SETQ BASE (ffetch (STRINGP BASE) of (SETQ STRING (MKSTRING STRING)))) (SETQ OFFST (ffetch (STRINGP OFFST) of STRING)) (SETQ LEN (ffetch (STRINGP LENGTH) of STRING)) (OR (ILEQ LEN \PNAMELIMIT) (RETURN))) (if (EQ LEN 1) then (RETURN (if (OR (IGREATERP (\GETBASEBYTE BASE OFFST) (CHARCODE 9)) (ILESSP (\GETBASEBYTE BASE OFFST) (CHARCODE 0))) then 0))) (SETQ HINDEX (OR (\ATOM.FIRSTHASHINDEX BASE OFFST LEN) (RETURN))) (RETURN (for PROBES from 1 bind HTENT ATOMINDEX until (EQ 0 (SETQ HTENT (\GETBASE \AtomHashTable HINDEX))) do (SETQ ATOMINDEX (\ADDBASE \ATOMSPACE (SUB1 HTENT))) (if (AND (EQ LEN (fetch (LITATOM PNAMELENGTH) of ATOMINDEX)) (NOT (bind (NBASE ←(fetch (LITATOM PNAMEBASE) of ATOMINDEX)) find I to LEN as J from OFFST suchthat (NEQ (\GETBASEBYTE NBASE I) (\GETBASEBYTE BASE J))))) then (* So these two atom have the same pname characters) (RETURN PROBES)) (SETQ HINDEX (LOGAND (IPLUS HINDEX \HashInc) \AtomHTmask)) (* \HashInc is relatively prime to \AtomHTmask so we will cycle thru all slots) ))))) (\ATOM.FIRSTHASHINDEX (LAMBDA (BASE OFFST LEN) (* JonL " 7-May-84 01:31") (if (EQ 0 LEN) then 0 else (for I from 0 bind (HINDEX ← 0) (NUM? ← T) (NDOTS ← 0) CHAR TEM while (ILESSP I LEN) do (* Mash down the string into a 15-bit number, to use as the initial probe index) (SETQ CHAR (\GETBASEBYTE BASE (IPLUS OFFST I))) (if (OR (IGREATERP CHAR (CHARCODE 9)) (ILESSP CHAR (CHARCODE 0))) then (SETQ NUM?) elseif (AND NUM? (EQ CHAR (CHARCODE %.))) then (* A number is allowed up to one decimal point) (if (ILESSP 1 (add NDOTS 1)) then (SETQ NUM?))) (SETQ TEM (IPLUS HINDEX (LLSH (LOADBYTE HINDEX 0 12) 2))) (SETQ HINDEX (LOGAND (IPLUS (LOGAND TEM \AtomHTmask) (LLSH (LOADBYTE TEM 0 7) 8) CHAR) \AtomHTmask)) finally (RETURN (AND (NULL NUM?) HINDEX)))))) ) (* functions for turning the display off.) (DEFINEQ (DISPLAYDOWN [LAMBDA (FORM NSCANLINES) (* rrb "27-MAR-82 12:23") (* evaluates form with the number of scan lines set down.) (RESETFORM (SETDISPLAYHEIGHT (OR (SMALLP NSCANLINES) 0)) (EVAL FORM]) (SETDISPLAYHEIGHT [LAMBDA (NSCANLINES) (DECLARE (GLOBALVARS \DisplayStarted \EM.DISPLAYHEAD)) (* bvm: " 5-JAN-83 18:48") (* sets the number of scan lines to be displayed.) (* returns previous setting.) (* the number of lines in the dcb is 1/2 of the total. High bit is on to indicate long pointers.) (OR \DisplayStarted (HELP "Display must be initialized.")) (AND \EM.DISPLAYHEAD (PROG [(MAGICADDR (EMPOINTER (IPLUS (\GETBASE \EM.DISPLAYHEAD 0) 3] (RETURN (PROG1 (ITIMES [LOGAND (\GETBASE MAGICADDR 0) (CONSTANT (SUB1 (EXPT 2 (SUB1 BITSPERWORD] 2) (* number of dcb lines may need to be even.) (COND (NSCANLINES (COND [(SMALLP NSCANLINES) (COND ((IGREATERP 0 NSCANLINES) (\ILLEGAL.ARG NSCANLINES)) ((IGREATERP NSCANLINES SCREENHEIGHT) (SETQ NSCANLINES SCREENHEIGHT] ((EQ NSCANLINES T) (SETQ NSCANLINES SCREENHEIGHT)) (T (\ILLEGAL.ARG NSCANLINES))) (\PUTBASE MAGICADDR 0 (LOGOR (ITIMES (LRSH NSCANLINES 2) 2) (CONSTANT (EXPT 2 (SUB1 BITSPERWORD]) (VIDEORATE [LAMBDA (TYPE) (* bvm: " 7-NOV-83 17:28") (DECLARE (GLOBALVARS \VIDEORATE)) (PROG1 \VIDEORATE (* Return old setting) (AND TYPE (SETQ \VIDEORATE (SELECTC \MACHINETYPE (\DOLPHIN (SELECTQ TYPE ((NORMAL 77) (\DSPRATE 9 0 0) (QUOTE NORMAL)) ((TAPE 60) (\DSPRATE 139 0 0) (QUOTE TAPE)) (\ILLEGAL.ARG TYPE))) (\DORADO (SELECTQ TYPE ((NORMAL 77) (\DSPRATE 18 14 430) (QUOTE NORMAL)) ((TAPE 60) (\DSPRATE 18 14 560) (QUOTE TAPE)) ((PHILLIPS TAPEP) (\DSPRATE 58 25 520) (QUOTE PHILLIPS)) (\ILLEGAL.ARG TYPE))) (\DANDELION (SELECTQ TYPE ((NORMAL 77) (\DEVICE.OUTPUT 14 7) (QUOTE NORMAL)) ((TAPE 60) (\DEVICE.OUTPUT 142 7) (QUOTE TAPE)) (\ILLEGAL.ARG TYPE))) (QUOTE NORMAL]) ) (RPAQ? \VIDEORATE (QUOTE NORMAL)) (DECLARE: DONTEVAL@LOAD DOCOPY (ADDTOVAR BREAKRESETFORMS (SETDISPLAYHEIGHT T)) (ADDTOVAR RESETFORMS (SETDISPLAYHEIGHT T)) ) (DECLARE: DONTEVAL@LOAD DOCOPY (RPAQQ #EOLCHARS 1) [OR (LISTP (EVALV (QUOTE EDITCHARACTERS))) (RPAQ EDITCHARACTERS (QUOTE (J X Z Y N] (ADDTOVAR POSTGREETFORMS (CNDIR)) (ADDTOVAR LISPUSERSDIRECTORIES ) ) (PUTPROPS BAKTRACELST VARTYPE ALIST) (ADDTOVAR BREAKMACROS (BT (BAKTRACE LASTPOS NIL (BREAKREAD (QUOTE LINE)) 0 T)) (BTV (BAKTRACE LASTPOS NIL (BREAKREAD (QUOTE LINE)) 1 T)) (BTVPP (PROG ((SYSPRETTYFLG T)) (BAKTRACE LASTPOS NIL (BREAKREAD (QUOTE LINE)) 1 T))) (BT! (BAKTRACE LASTPOS NIL (BREAKREAD (QUOTE LINE)) 0 T))) (ADDTOVAR BAKTRACELST (EVAL (**BREAK** LISPX ERRORSET BREAK1A ERRORSET BREAK1) (**TOP** LISPX ERRORSET EVALQT T) (**EDITOR** ((MAPCAR APPLY) (ERRORSET LISPX)) ERRORSET ERRORSET ERRORSET EDITL1 EDITL0 ERRORSET ((ERRORSET ERRORSET ERRORSET EDITL1 EDITL0 ERRORSET) -) EDITL ERRORSET ERRORSET EDITE ((EDITF) (EDITV) (EDITP) -)) (**USEREXEC** ERRORSET LISPX ERRORSET ERRORSET USEREXEC)) (APPLY (**BREAK** LISPX ERRORSET BREAK1A ERRORSET BREAK1) (**TOP** LISPX ERRORSET EVALQT T) (**EDITOR** LISPX ERRORSET ERRORSET ERRORSET EDITL1 EDITL0 ERRORSET ((ERRORSET ERRORSET ERRORSET EDITL1 EDITL0 ERRORSET) -) EDITL ERRORSET ERRORSET EDITE ((EDITF) (EDITV) (EDITP) -)) (**USEREXEC** LISPX ERRORSET ERRORSET USEREXEC))) (DECLARE: DONTEVAL@LOAD DOCOPY (RPAQ? CLEANUPOPTIONS (QUOTE (RC))) ) (DEFINEQ (DOAROUNDEXITFORMS (LAMBDA (EVENT) (* JonL "13-Sep-84 13:42") (* For backward compatibility, handle the xxxFORMS that used to be in advise around LOGOUT, SYSOUT, MAKESYS) (for $$FORM in (SELECTQ EVENT (BEFORELOGOUT BEFORELOGOUTFORMS) (AFTERLOGOUT AFTERLOGOUTFORMS) (BEFORESYSOUT BEFORESYSOUTFORMS) (AFTERSYSOUT AFTERSYSOUTFORMS) (BEFOREMAKESYS BEFOREMAKESYSFORMS) (AFTERMAKESYS AFTERMAKESYSFORMS) NIL) do (ERSETQ (\EVAL $$FORM))))) ) (ADDTOVAR AROUNDEXITFNS DOAROUNDEXITFORMS) (ADDTOVAR BEFORELOGOUTFORMS ) (ADDTOVAR AFTERLOGOUTFORMS ) (DECLARE: DONTEVAL@LOAD DOCOPY (RPAQ? ADVISEDFNS ) ) (* from FASTARRAYS) (DEFINEQ (POINTERARRAY [LAMBDA (N INIT) (* lmm " 4-DEC-80 16:58") (ARRAY N (QUOTE POINTER) INIT 0]) (WORDARRAY [LAMBDA (N) (* lmm " 4-DEC-80 16:58") (ARRAY N (QUOTE SMALLPOSP) 0 0]) (FIXPARRAY [LAMBDA (N) (* lmm " 4-DEC-80 16:58") (ARRAY N (QUOTE FIXP) 0 0]) ) [MAPC (QUOTE ((ELT FASTELT FASTELTN FASTELTW) (SETA FASTSETA FASTSETAN FASTSETAW) (GETHASH IGETHASH) (PUTHASH IPUTHASH))) (FUNCTION (LAMBDA (X) (MAPC (CDR X) (FUNCTION (LAMBDA (Y) (MOVD? (CAR X) Y] (* Versions etc) (DEFINEQ (REALMEMORYSIZE [LAMBDA NIL (* bvm: "19-JAN-83 17:06") (fetch NRealPages of \InterfacePage]) (LISPVERSION [LAMBDA NIL (* bvm: "19-JAN-83 17:07") (fetch LVersion of \InterfacePage]) (MICROCODEVERSION [LAMBDA NIL (* bvm: "19-JAN-83 17:07") (fetch RVersion of \InterfacePage]) (BCPLVERSION [LAMBDA NIL (* bvm: "19-JAN-83 17:07") (fetch BVersion of \InterfacePage]) (REQUIREVERSION [LAMBDA (LISP MICROCODE BCPL) (* bvm: "19-JAN-83 17:15") (PROG (TYPE NEEDED) (RETURN (COND ([SETQ TYPE (OR (AND LISP (LESSP (fetch LVersion of \InterfacePage) (SETQ NEEDED LISP)) (QUOTE LISP)) (AND MICROCODE (LESSP (fetch RVersion of \InterfacePage) (SETQ NEEDED MICROCODE)) (QUOTE MICROCODE)) (AND BCPL (LESSP (fetch BVersion of \InterfacePage) (SETQ NEEDED BCPL)) (QUOTE BCPL] (ERROR (CONCAT "This " TYPE " version is too old. The minimum version required is ") NEEDED) NIL) (T T]) ) (* Misc ops) (DEFINEQ (READPRINTERPORT [LAMBDA NIL (* bvm: "18-JAN-83 18:06") ((OPCODES READPRINTERPORT]) (WRITEPRINTERPORT [LAMBDA (DATUM) (* bvm: "18-JAN-83 18:06") ((OPCODES WRITEPRINTERPORT) DATUM]) (\READPRINTERPORT.UFN [LAMBDA NIL (* hdj "16-Sep-84 21:37") (if (EQ \MACHINETYPE \DANDELION) then (\DEVICE.INPUT 7]) (\WRITEPRINTERPORT.UFN [LAMBDA (DATUM) (* hdj "16-Sep-84 21:45") (if (EQ \MACHINETYPE \DANDELION) then (\DEVICE.OUTPUT DATUM 14]) (\MISC1.UFN [LAMBDA (ARG ALPHA) (* bvm: "18-JAN-83 18:07") (RAID "Unimplemented MISC1 op" ALPHA]) (\MISC2.UFN [LAMBDA (ARG1 ARG2 ALPHA) (* bvm: "18-JAN-83 18:07") (RAID "Unimplemented MISC2 op" ALPHA]) ) (DECLARE: DOEVAL@COMPILE DONTCOPY (LOCALVARS) ) (DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS (ADDTOVAR NLAMA ) (ADDTOVAR NLAML TIMEALL) (ADDTOVAR LAMA ) ) (PUTPROPS DMISC COPYRIGHT ("Xerox Corporation" T 1982 1983 1984)) (DECLARE: DONTCOPY (FILEMAP (NIL (3671 4142 (TENEX 3681 . 4140)) (4143 4880 (BACKSPACEDEL 4153 . 4878)) (4994 17071 ( TIMEALL 5004 . 7457) (COPYMISCSTATS 7459 . 8326) (COPYTIMESTATS 8328 . 9423) (CREATEMISCSTATS 9425 . 9835) (DIFFMISCSTATS 9837 . 11514) (DIFFTIMESTATS 11516 . 13707) (PRINTMISCSTATS 13709 . 16515) ( PRINTMISCSTATSITEM 16517 . 17069)) (17195 17635 (PERIODICALLYRECLAIM 17205 . 17633)) (17812 20758 ( APROPOS 17822 . 20523) (\APROPOS.MARGINSET 20525 . 20756)) (20759 22148 (\DIRTYBACKGROUND 20769 . 21151) (\SAVEVMBACKGROUND 21153 . 21766) (COPYVM 21768 . 22146)) (22564 23356 (SETTIME 22574 . 23354)) (23388 26736 (RINGBELLS 23398 . 24202) (FLASHWINDOW 24204 . 25670) (\DISMISS.WITHOUT.BLOCKING 25672 . 25982) (PLAYTUNE 25984 . 26734)) (27048 29908 (ATOMHASH#PROBES 27058 . 28783) (\ATOM.FIRSTHASHINDEX 28785 . 29906)) (29960 32877 (DISPLAYDOWN 29970 . 30313) (SETDISPLAYHEIGHT 30315 . 31767) (VIDEORATE 31769 . 32875)) (34598 35248 (DOAROUNDEXITFORMS 34608 . 35246)) (35453 35906 (POINTERARRAY 35463 . 35613) (WORDARRAY 35615 . 35761) (FIXPARRAY 35763 . 35904)) (36188 37530 (REALMEMORYSIZE 36198 . 36359 ) (LISPVERSION 36361 . 36517) (MICROCODEVERSION 36519 . 36680) (BCPLVERSION 36682 . 36838) ( REQUIREVERSION 36840 . 37528)) (37552 38573 (READPRINTERPORT 37562 . 37706) (WRITEPRINTERPORT 37708 . 37866) (\READPRINTERPORT.UFN 37868 . 38062) (\WRITEPRINTERPORT.UFN 38064 . 38267) (\MISC1.UFN 38269 . 38419) (\MISC2.UFN 38421 . 38571))))) STOP