Page Numbers: Yes First Page: 1
Heading:
[IVY]<KRL>document>stray-henry
Transcribed from notes mailed by Henry Thompson, July 15, 1977
KRL RECORDS
MEMOBJRECORDS has the declarations for the memory structures which live off the file. The form is
(KRLMEMSTRUC name field1 field2 ...) {named} {(Flags flg 1 flg2...flg5)} . Tail)
Field = atom (for 1 word fields) | (atom number) (for n word fields)
Every descriptor should have the field metaAnchor as second field, that is, second in the list if unnamed, first if named. Fetch accesses to multiword fields smash the handle to point to the first word of the field, e.g., (FetchMem Foo descrs), where Foo originally pointed to the front of an anchor, would increment it by 2 to point directly to the first word of the descr field, as well as fetching its contents.
PARSEFNS
builds a descriptor of type surrogate for ! !! or !!! except for !Name e, which produces (LIST e), so ConvFns should, when seeking an atom, do
(if (LISTP a) then (EVAL (CAR a)) else a)
PRINTFNS
will print intermediate structures only.
UNITFNS
Editing won’t work much.
Defprint etc. is set up to deal with LISP containing KRL, whether compiled or not.
READUNITS calls NEWUNIT, which catalogues and converts, but \# as yet does not.
GETUNIT(???) will try to get a handle.
Also note datatype printing forms as described in David’s document.
LOADKRL
Not room for all packages and their databases. I usually don’t load database for NAMEFNS, nor the DLISP stuff. Contains most user important flags.
CATALOGFNS
Not much altered.
CONVFNS
ConvDescriptors, CMetaShift ConvSExp ConfSlot ConvSlotLink ConvUnit, SlotFor revised up to date.
Conv Descriptor framework OK, terms for METASHIFT, LISPPOINTER, SLOTPOINTER UNITPOINTER IMPAND okay
Bug in LISPPOINTER, it cannot take notes.
MEMSTRUC
FileObjectName(handle)
Returns the name of a named object pointed to by handle, either as an atom or a CONS of 2 atoms.
GetFileObject(name oldHandle type) Looks up name on file.
See comment in file, or NAMEFILE
HandleFor(sExp old Handle) make a pseudoHandle for sExp
See comment in file or NAMEFILE
*LispFor(handle)* Denotes a Macro
Get the sExp pointed to by handle, which must be a pseudoHandle
ReleaseHandle(pseudo Handle) frees the sExp pointed to.
See comment.
SpaceName(handle oldHandle) smashes oldHandle if there. Gets name of space handle points into. See Comment.
FetchMem (handle field oldHandle)
Returns the handle in field of the object pointed to by handle. Smashes this into oldHandle if "present". As this is a computed macro, "present" means in the calling form. Thus (Fetchmem Foo f. BAR) will cause an error if BAR is not bound to a handle at runtime.
See comment in file. Fetching a multiword field smashes handle with handle and offset, see KRLRECORDS.
*HandleValue(h) the 36 bit actual contents of h, a handle.
See comment in file.
*KrlCreate(recordName objectName spaceName oldHandle . flgs)
Allocates an object of type recordName in space
(OR spaceName CURRENTMEMORYSPAC NeutralSpace).
Gives it objectName if present. Smashes into oldHandle if present. Turns on flgs, if any. Uses AllocateFileObject to do most of the work, so objectName spaceName and oldHandle can be uncompiled at runtime (not like FetchMem) Turns on last Entry bit in appropriate places in Object. See comment in file
*StoreMem (handle field valueHandle)
Puts value Handle into field of object pointed to by handle.
See comment in file. Value is not interesting.
LISTFNS
EQH(h1 h2) EQUAL for handles, checks file pointer field only, has a macro.
*AppendHandle(newHandle pointerHandle oldHandle noSmashFlg)
*InsertHandle(newHandle pointerHandle oldHandle noSmashFlg)
Put newHandle into a multi-word field just ahead of (Insert) or just after (Append) where pointerHandle points. Uses oldHandle as a temporary if present (in form, see above under FetchMem)
Unless noSmashFlg is non-NIL, smashes pointerHandle as it ripples down the sequence, and returns it as value, thought probably it’s not of any use.
*CopyHandle(oldHandle copyHandle)
Copies the oldHandle itself, to copyHandle or a new one if not present (in form). Moves all 36 bits.
*FindHandle(datum handle field oldHandle) ~ FMEMB
Constructs code which returns either NIL or a pointer to the first non-degenerate (NULL, SKIP, or EXTEND) entry in the multiword field of object pointed to by handle, if field is given, else in multiword field into which handle points directly. Revises oldHandle if given, but even so builds one more handle.
*NthHandle (handle field n oldHandle pointerFlg) ~ NTH
Like FindHandle but gets nth real handle or NIL. If pointerFlg, it returns a handle which points to handle (i.e., a tail like FindHandle), otherwise the handle itself.
*NullifyHandle(handle)
Smashes the handle pointed to by handle to be of type skip, thus eliminating it.
*DeleteHandle(datum handle field oldHandle) ~ DREMOVE
=(NullifyHandle (FindHandle datum handle field oldHandle))
Return T if done, else NIL
*DeleteNthHandle(handle field n oldHandle) =
=(NullifyHandle (NthHandle handle field n oldHandle T))
Returns T if done, else NIL
*IncludeHandle(newHandle pointerHandle field oldHandle noFillSkipFlg smashFlg)
Adds newHandle to multiword field of pointerHandle (if field is there) or else to field pointed into by pointerHandle. Puts it in first available spot unless noFillSkipFlg, in which case puts it at the end. If smashFlg, then smashes pointer Handle as it goes, returning with pointing of new entry.
*NullHandle(handle) = T if handle is file NIL, that is points nowhere (0), NIL otherwise.
CLISP Iterative Operators
(1)(for X fromField field ofHandle {smashIt} handle...
(2)(for X fromHandle {smashIt} handle...
The body of the statement will be done with X bound to a handle which successively will be each real handle in the multiword field field of the object pointed to by handle (1) or of the multiword field pointed into directly by handle (2). In either case smashIt indicates handle is to be smashed as we go along. A new handle for X is not built each time, so to save it use CopyHandle, e.g., ...collect (CopyHandle x))
...as i from 1 as y in Y does the right thing.
See e.g. defn of NthHandle.
(...addHandle {fillSkips} h toField field ofHandle {smashIt} handle) (3)
(...addHandle {fillSkips} h toHandle {smashIt} handle) (4)
for use as body of iterative stmt. Efficiently calls
(IncludeHandle h handle (field) ~fillSkips smashIt)
for each iteration on h. That is adds all the h’s to (field field of) for (3) or to handle for (4), filling skips if fillSkips is there, otherwise adding only at end, smashing handle is smashIt is there, otherwise not.
...useHandle oldHandle
if is occurs in any of the above will reuse oldHandle.
If both smashIt and useHandle are there, these forms build no new handles.
`
*Denotes a macro