{Begin Chapter Miscellaneous}
{Title Miscellaneous}
{Text


{FnDef {Name SYSTEMTYPE}
{Text
The {fn SYSTEMTYPE} function is intended to allow programmers to write system-dependent code.  {fn SYSTEMTYPE} returns a litatom corresponding to the implementation of Interlisp: {lisp D} (for Interlisp-D), {lisp TOPS-20}, {lisp TENEX}, {lisp JERICO}, or {lisp VAX}.

In Interlisp-D (and Interlisp-10), {lisp (SELECTQ (SYSTEMTYPE) {ellipsis})} expressions are expanded at compile time so that this is an effective way to perform conditional compilation.
}}



{FnDef {FnName USERNAME} {FnArgs A FLG}
{Text
If {arg A}={lisp NIL}, returns login directory name;
if {arg A}={lisp T}, returns connected directory name;
if {arg A} is a number, {fn USERNAME} returns the user name corresponding to that user number.

The value is usually returned as a string.
If {arg FLG} is a string ptr, it is smashed.
If {arg FLG} is not a string pointer and is non-{lisp NIL}, {fn USERNAME} returns the value as an atom.
}}



{FnDef {FnName STORAGE} {FnArgs FLG GCFLG}
{Text
Prints the amount of storage used for various data types.  The exact printout is implementation-dependent.  {fn STORAGE} returns {lisp NIL}.

In Interlisp-10, the storage used by a particular type is only accurate immediately following a garbage collection of a related type.  If {arg GCFLG}={lisp T}, {fn STORAGE} will perform the necessary garbage collections before printing its results. If {arg FLG}={lisp T}, includes storage used by and assigned to the system.

In Interlisp-D, {fn STORAGE} has no optional arguments. {fn STORAGE} prints out a summary, for each data type, of the number of pages allocated to that type, the number of items on the "free list", and (derived from those), the number of items in use.  The last column displays the {fn BOXCOUNT} for the data-type; i.e., the total number of items ever allocated.  At the end of the printout is a summary of the various major data areas and their usage. (There are some areas which are of fixed size, part of the total virtual address space, but not indicated in the {fn STORAGE} display. 

When a data type is redeclared, the name is reassigned. Pages which were assigned to instances of the old datatype are labeled {lisp **DEALLOC**}.
}}


{Begin Note}
Date: 25 June 1982 9:02 pm PDT (Friday)
From: KAPLAN.PA
Subject: New feature suggestion:  TYPES argument to STORAGE

A user who is only interested in a small number of types has to wait while his screen gets garbled with information about the large number of system datatypes that we now have.

I propose changing STORAGE so that it takes an argument which is either a type name or a list of typenames (or NIL meaning all types), and it only prints information about the types in the list.
{End Note}


{FnDef {Name DISMISS} {Args MSECSWAIT TIMER}
{Text
Dismisses the program for {arg MSECSWAIT} milliseconds. Can be aborted by interrupts such as control-D, control-E, or control-B.

In Interlisp-10 and -VAX, the program uses no CPU time while waiting.

In Interlisp-D, {fn DISMISS} allows other Lisp processes to run, i.e., the current process is suspended for {arg MSECSWAIT} milliseconds.  In addition {fn DISMISS} can be given a timer {arg TIMER}, in which case it will ignore {arg MSECSWAIT} and await the expiration of {arg TIMER} (see {PageRef Tag Timers}).
}}



{FnDef {FnName APROPOS} {FnArgs STRING ALLFLG QUIETFLG}
{Text
(Currently only in Interlisp-D)  {fn APROPOS} scans all litatoms in the system (using {fn MAPATOMS}) for those which have {arg STRING} as a substring and prints them on the terminal,{foot
With {fn PRINTLEVEL} set to {lisp (3 . 5)} (see {PageRef Fn PRINTLEVEL}).
}{comment endfootnote}
along with a line for each relevant item defined for each selected atom.  Relevant items are (1) function definitions, for which only the arglist is printed, (2) dynamic variable values, and (3) non-null property lists.

If {arg ALLFLG} is {lisp NIL}, then atoms with no relevant items and "internal" atoms are omitted ("internal" currently means those litatoms whose print name begins with a {lisp \} or those litatoms produced by {fn GENSYM}). If {arg ALLFLG} is a function (i.e., {lisp (FNTYP {arg ALLFLG})} is non-{lisp NIL}), then it is used as a predicate on atoms selected by the substring match, with value {lisp NIL} meaning to omit the atom. if {arg ALLFLG} is any other non-{lisp NIL} value, then no atoms are omitted.

If {arg QUIETFLG} is non-{lisp NIL}, then no printing at all is done, but instead a list of all selected atoms is returned.
}}



{FnDef {FnName NEGATE} {FnArgs X}
{Text
For a form {arg X}, returns a form which computes the negation of {arg X} . For example:

{lispcode (NEGATE '(MEMBER X Y))  =>  (NOT (MEMBER X Y))}

{lispcode (NEGATE '(EQ X Y))  =>  (NEQ X Y)}

{lispcode (NEGATE '(AND X (NLISTP X)))  =>  (OR (NULL X) (LISTP X))}

{lispcode (NEGATE NIL) => T}
}}



The following two functions are useful writing programs that wish to reuse a scratch list to collect together some result (Both of these compile open):


{FnDef {FnName SCRATCHLIST} {FnArgs LST X{SUB 1} X{SUB 2} {ellipsis} X{SUB N}}
{Type NLAMBDA NOSPREAD}
{Text
{fn SCRATCHLIST} sets up a context in which the value of {arg LST} is used as a "scratch" list.  The expressions {arg X{sub 1}}, {arg X{sub 2}}, {ellipsis} {arg X{sub N}} are evaluated in turn.  During the course of evaluation, any value passed to {fn ADDTOSCRATCHLIST} will be saved, reusing {fn CONS} cells from the value of {arg LST}.  If the value of {arg LST} is not long enough, new {fn CONS} cells will be added onto its end.  If the value of {arg LST} is {lisp NIL}, the entire value of {fn SCRATCHLIST} will be "new" (i.e. no {fn CONS} cells will be reused).
}}



{FnDef {FnName ADDTOSCRATCHLIST} {FnArgs VALUE}
{Text
For use under calls to {fn SCRATCHLIST}.  {arg VALUE} is added on to the end of the value being collected by {fn SCRATCHLIST}.  When {fn SCRATCHLIST} returns, its value is a list containing all of the things that {fn ADDTOSCRATCHLIST} has added.
}}


{Include Sysout}

{Include Greet}

{Include DIR}

{Include SortingLists}

{Include DateTime}

{Include Duration}

{Include GainSpace}

{Include Measuring}

{Include Pmap}



}{End Chapter Miscellaneous}