X-Git-Url: https://jxself.org/git/?p=pdp10-muddle.git;a=blobdiff_plain;f=mim%2Fdevelopment%2Fmim%2Fvax%2Fmimlib%2Fl-query.mud;fp=mim%2Fdevelopment%2Fmim%2Fvax%2Fmimlib%2Fl-query.mud;h=e4439bcb867332459e720a5e6be26c9a45163852;hp=0000000000000000000000000000000000000000;hb=d73ace3f3292e320b461b8fcd2e9f5dc5d9684d7;hpb=d530283ea60fb0ddcc28e9c5bd072456afe06e07 diff --git a/mim/development/mim/vax/mimlib/l-query.mud b/mim/development/mim/vax/mimlib/l-query.mud new file mode 100644 index 0000000..e4439bc --- /dev/null +++ b/mim/development/mim/vax/mimlib/l-query.mud @@ -0,0 +1,676 @@ + + +;"**************************************************************************** + + This file defines a query facility for the LIBRARY system: listing names of + packages, entries, counts of same, findatom, etc. Both network and local + libraries can be queried. See definition of library records (long, short) + in LIBRARY.FORMAT. + + L-QUERY.MUD: EDIT HISTORY Machine Independent + + COMPILATION: XMIMC L-QUERY /NC + + JUN84 [Shane] - Created. + 11OCT84 [Shane] - Commented, cleaned up. + 21OCT84 [Shane] - New protocols. + 29OCT84 [Shane] - L-DOC optionally (default) prints documentation files. Flush + some internal functions. Create some shareable internal + functions. Rewrite some kludges. + ***************************************************************************" + + + + + + + "L-DEFS" !> + +)> + +%% ;"Splice into code." + +%% + +;"L-DOC -- + Effect: If PKG is documented in library denoted LIBS, the documentation + is printed on OUTCHAN. If the documentation is a file, the name of + the file is printed in standard format (and if PRINT-FILE? is non- + false, the contents of the file is printed as well). If PKG is in + library denoted by LIBS but not documented, a message to the effect + is printed. + Modifies: OUTCHAN. + Returns: T if PKG is found, FALSE otherwise." + + T) + (OUTCHAN:CHANNEL .OUTCHAN) + "AUX" (LIBC: %<>) + (DOC: %<>)) + >) DEV: + PREFIX: RINFO:FIX DOCLEN:FIX DOCSTR:STRING + SNM: FN:) + >> + >) + (>> ;"Short record" + + >)> + > ;"Path specification." + + > ;"Record information." + 2>>> ;"File name sizes." + + 2>>> + >> ;"Doc length is high byte." + + + )> + > ;"Documentation string, no file." + >) + ( ;"Network library path spec." + >>) + (T ;"Local library file spec." + > + > + >> + > + )> + + > + ;"Get the documentation file from LIBS and print it." + .LIBS>> + + + ) + (T + )>)> + > + > + >>>> + +;"L-FILES -- + Effect: If PKG is found in library denoted by LIBS, the names of the files + associated with the PKG are printed on OUTCHAN in standard format. + Modifies: OUTCHAN. + Returns: T if PKG is found, otherwise FALSE." + + %<>)) + >) DEV: + PREFIX: FNSIZES:FIX RINFO:FIX + SNM:) + >> + >) + (>> + + >)> + > ;"Path specification." + + > ;"Record information." + 2>>> ;"File name sizes." + 2>>> ;"Move to names." + > ;"If no doc file, mask doc size." + >>)> + ) + > 0> + ;"Network file." + + .OUTCHAN>) + (T ;"Local file." + > + > + >> + .OUTCHAN> + )> + + >)> + >> )>>> + > )>>> + +;"MAKE-PREFIX -- + Effect: Construct specification of library directory: a string specifying + host directory if LIBC is NETWORK channel, otherwise a vector + containing DEV, SNM if LIBC is local channel. + Returns: Path specification for LIBC. + Requires: LIBC is not closed." + + UNIX: host:hostdir/" + + >)>)> + ;"Local: [DEV SNM]" + ]>>> + +;"L-LISTPE -- + Effect: If PKG is found in LIBRARY denoted by LIBS, the names of all the + entrys and rentrys of PKG are printed together with type information + on OUTCHAN. + Returns: T if PKG is found, otherwise FALSE. + Modifies: OUTCHAN." + + %<>)) + >) + (S:STRING >) (PRINTED:FIX 0) + ERCNT:FIX DELTAE:FIX RINFO:FIX) + >> + >) + (> + + >)> + + > ;"Record information." + ;"PACKAGE or DEFINITIONS?" + ) + (T + )> + ;"Print module name." + .S >> + + 3>>> + > ;"R/ENTRY count." + > ;"Distance to entry list." + ;"Print entries." + + + + + )> + )> + >> + ;"Entry?" + > + + .S .OUTCHAN T> + )> + > + 1>>> + + ;"Print rentries if any." + + + + )> + ) (DELTA:FIX .DELTAE) ERTYPE:FIX) + >> + > ;"Rentry?" + + .S .OUTCHAN T> + + >> + )>)> + 1>>>> + > )>>> + +;"PRINT-ENTRY -- + Effect: Prints descriptive information about entry descriptor at head of + U (should be record rested to entry descriptor). The name of the + entry followed by a space is printed to OUTCHAN. If VERBOSE? is + non-false, then type information is also printed. S is buffer. + Modifies: S, OUTCHAN + Requires: U is library record rested to entry descriptor word. + size(S) >= MAXSTRS." + + + "AUX" (ERTYPE:FIX <1 .U>) FIELD:FIX) + .S >> + + >> 0> + )> + + )> + > + .OUTCHAN> + ) + ( + )> + + )>)> + T> + +;"L-COUNTP -- + Effect: Fetch count of number of packages or definitions contained in + library denoted by LIBS. + Returns: Package count if successful, otherwise FALSE." + + %<>)) + > >)) + >> + >)> + > + + )>> + > )>>> + +;"L-COUNTE -- + Effect: Fetch count of number of entries or rentries contained in + library denoted by LIBS. + Returns: Entry count if successful, otherwise FALSE." + + %<>)) + > >)) + >> + >)> + > + + )>> + > )>>> + +;"GET-LIBRARY-STATISTICS -- + Effect: Fetch library counts from LIBC into STATS. + Modifies: LIBC, STATS + Returns: STATS = ![packages entries!] if successful, otherwise FALSE. + Requires: Server is waiting for request if LIBC is NETWORK channel." + +) + + <1 .STATS ,COUNT-REQUEST> + + ) + (T >)>)>)> + ;"Local, access to counts and read." + + .STATS)>>> + + +;"L-LISTE -- + Effect: Print the names of every entry or rentry in every package or + definitions in library denoted by LIBS to outchan. + Modifies: OUTCHAN." + + %<>)) + >)) + >> + >) + (>> + + >)> + >) + (S:STRING >)) + + + ) + (T + + + )>>> + > )>>> + +;"LISTE -- + Effect: Print the name of RECORD and whether it represents a package or + definitions. The print all the entries followed by all the + rentries to OUTCHAN. + Modifies: S, OUTCHAN. + Requires: RECORD is properly formatted record as defined in LIBRARY.FORMAT, + size(S) >= MAXSTRS." + +) (PRINTED:FIX 0) DELTAE:FIX ERCNT:FIX) + ;"PACKAGE or DEFINITIONS?" + ) + (T + )> + ;"Print module name." + .S >> + + 3>>> + > ;"R/ENTRY count." + > ;"Distance to entry list." + ;"Print entries." + + + + )> + + )> + >> + ;"Entry?" + > + > .S >> + ;"Dont overflow right margin." + .NAMLEN 1> 79> + + )> + + )> + > + 1>>> + + + ;"Print rentries if any." + + + + )> + ) (DELTA:FIX .DELTAE) + ERTYPE:FIX NAMLEN:FIX) + >> + > ;"Rentry?" + > .S >> + ;"Dont overflow right margin." + .NAMLEN 1> 79> + + )> + + + >> + + )>)> + 1>>> + T> + +;"L-LISTP -- + Effect: Print the names of all the packages and definitions in library + denoted by LIBS to OUTCHAN. + Modifies: OUTCHAN." + + %<>)) + >)) + >> + >) + (>>> + + >)> + + >) + (NAME:STRING >) NAMLEN:FIX) + > + .NAME >>> + .NAMLEN 1> 79> + )> + + ) + (T + + + )>>> + > )>>> + +;"L-FINDATOM -- + Effect: Every entry or rentry in library denoted by LIBS whose pname matches + SPECSTR is printed to OUTCHAN with associated type information. + * in SPECSTR denotes zero or more characters, all other characters + represent themselves. There is no quote for * (tough shit). + Modifies: OUTCHAN." + + %<>)) + >)) + >> + >) + (>> + + >)> + + >) + (S:STRING >)) + + ) + (T + + + )>>> + > )>>> + +;"MATCH-AND-PRINT -- + Effect: Prints the names of any entrys or rentrys in RECORD which match + SPECSTR along with type information. The name of the package or + definitions is printed if there is at least one match. + Modifies: S, OUTCHAN + Requires: RECORD is properly formatted library record as defined in + LIBRARY.FORMAT, size(S) >= MAXSTRS." + +> 3>>> 1>) + (ERCNT:FIX > 3>>>) + (BLURB?: %<>) MATCH?: ERLEN:FIX) + )> ;"Until every name considered." + >> ;"Pname length in words." + > ;"Non-false => found match." + %<>) + W:FIX B:CHARACTER) + !\*>> + ) + (T + ;"WILD? = SPECSTR rested to wild." + >)>> + > 0> ;"All bytes in this word done?" + ;"If all words done, set W to nulls." + > .ERLEN> ) + (T >>)>)> + >>> ;"Next char in pname." + > ;"Null => end of pname." + > ;"Must match every character." + ) + ( ;"If SPECSTR is empty." + > !\*> + ;"Then we have a match." + ) + (T + ;"Otherwise we back up." + >)>) ;"And reconsider." + (T ;"If there is no wild, then no match." + )>) + (<==? .B <1 .SPECSTR>> ;"Does it match current character?" + >) + (.WILD? ;"If not, back up if wild." + ) + (T ;"Else there is no match." + )>> + ;"If this is the first." + ;"Say what module this is." + + + ,RINFO-PKG?> + ) + (T + )> + .S >>> + + )> + + > .S .OUTCHAN T> + )> + > + > + >>> + +;"L-LISTU -- + Effect: Print the names of all the modules in library denoted by LIBS which + reference module named TARGETS. + Modifies: OUTCHAN." + + %<>) + (TARGETU:UVECTOR >>)) + >)) + ;"TARGETS as binary string." + >> + >) + (>> + + >)> + >) + (S:STRING >) UXICNT:FIX DELTA:FIX) + + > 4>>> + 1>> ;"Distance to UXI list." + > ;"Length of UXI list." + )> + >>> + + .UXILEN>> + ;"Match?" + ,RINFO-PKG?> + ) + (T + )> + .S + >>> + + ) + ( + ) + (T + )> + + + ) + (<==? .COMP 1> ;"Less than?" + > + >) + (T ;"Greater, we can stop looking." + )>>) + (T + + )>>> + > )>>> + +;"LQ-MAP-RECORDS -- + Effect: Sets up STATE for mapping over every record in LIBC. + Returns: STATE if successful, FALSE otherwise. + Modifies: STATE, LIBC + Note: If LIBC is NETWORK, the MAP-RECORDS request is made followed + by a request for the next record (with short bit determined + by value of LONG?. The request word is placed into STATE for + following requests." + + T)) + MAP-RECORDS. If that succeeds then NEXT-RECORD." + + <1 > ,MAP-RECORDS-REQUEST> + + > + + <==? <1 .STATE> ,ACK>> + ;"Request next and set up for following call." + <1 .STATE + )>> + + ) + (T >)>)>)> + ;"Local library." + >>> + +;"LQ-NEXT-RECORD -- + Effect: Fetches the next record from LIBC in map sequence if there is one. + Modifies: LIBC, STATE, RECORD + Returns: T if record was read into RECORD, else FALSE. + Requires: size(RECORD) >= size(record), STATE is descriptor created by + LQ-MAP-RECORDS and modified only by LQ-NEXT-RECORD. + Note: LONG? has no effect if library is network because that has + already been taken into account in STATE. The next record + is requested as soon as a record is received." + + T)) + record waiting. Request next after reception." + + + ;"Request next record." + + ) + (T >)>)>)> + ;"Local." + )) + >>>>> + +;"LQ-GET-RECORD -- + Effect: Fetch record named NAME into RECORD from LIBC. + Modifies: RECORD, LIBC + Returns: T if record was fetched, otherwise FALSE. + Requires: If LIBC is network channel, no request has been made yet + (the server will hang up when this request is processed)." + + T)) + send record request with name." + + <1 .RECORD + 8> ,RECORD-REQUEST + >> + + + ) + (T >)>)>)> + ;"Local." + >>> + +;"UVCOMP -- + Effect: Compare two binary strings (8-BIT ASCII UVECTORS). L1, L2 is + number of valid words in UV1, UV2 respectively. + Returns: 1 if UV1 sorts before UV2. 0 if UV1 matches UV2. -1 if + UV1 sorts after UV2. + Note: NULL byte is interpreted as end of string." + +) (L2:FIX )) + > >> + > + > + <==? .L2 0>> + + ) (T )>) + (T )>) + (T + > + >)>) + (T + > >>) + (> >>) + (> >>) + (T + > + >)> + ) (T )>>)>>> + +