;"***************************************************************************** This file defines a means for mapping over all records in LOCAL library. Used by iterative queries in L-QUERY and the server for handling the same over the network. L-QUERY-BASE.MUD: EDIT HISTORY Machine Independent COMPILATION: Spliced in at compile time. JUN84 [Shane] - Created. 8OCT84 [Shane] - Commented, cleaned up. ****************************************************************************" ;"MAP-RECORDS -- Effect: Create a state descriptor for NEXT-RECORD (somewhat like ASSOCIATIONS). The state descriptor is a UVECTOR with the following format: [next-bucket bucket-cdr last-bucket] where next-bucket is the file address of the next bucket in the hash table to examine (initially the first bucket). bucket-cdr is the file address of the next cons in the current bucket if it contained a list, else nil (0). (initially nil). last-bucket is the file address of the last bucket in the hash table. Modifies: STATE, LIB (the channel access pointer). Returns: state descriptor (UVECTOR). Requires: LIB is channel to correctly formatted library file (as defined in LIBRARY.FORMAT), size(STATE) >= 3. Note: The offsets are defined in L-DEFS.MUD." "OPT" (STATE: )) ;"The address of the first bucket is DIR-HDRLEN. The address of the last bucket is DIR-HDRLEN+DIR-TABSIZ-1. Point to DIR-TABSIZ and read." :FIX %<- ,DIR-HDRLEN 1>>> > ;"NEXT-RECORD -- Effect: Determine the file address of the next record in the iteration over the library. Addresses are yielded in bucket order, position in bucket list (if bucket contains a list). Modifies: STATE, LIB (the channel access pointer). Returns: File address of next record in sequence if any, else false. Requires: LIB is channel to correctly formatted library file (as defined in LIBRARY.FORMAT), STATE is a state descriptor created by MAP-RECORDS and modified by NEXT-RECORD (only!)." STATE:) ) (BKT:FIX ) (BCDR:FIX ) BCAR:FIX "NAME" NEXTR) ;"Are we in a list?" ;"Point to cons." > ;"Pointer to car." > ;"Pointer to cdr." ;"Package?" ;"Set things up for next time." .NEXTR>) (T )>) ;"Check out the cdr." (T ;"Empty bucket or end of list." ;"Every bucket done?" .NEXTR>) (T ;"Point to next bucket." > ;"Bump next." > ;"Read current bucket." ;"List?" > ) ;"Check out first cons above." ( ;"Package?" ;"Next." ;"Not in list." .NEXTR>)>)>>)>>>