From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 16-OCT-1989 19:58
To:	MRGATE::"ARISIA::EVERHART"
Subj:	LIBSEARCH SEARCH for VMS libraries 5/7

Message-Id:  <8910162040.AA03038@crdgw1.ge.com>
Received: From NSFNET-RELAY.AC.UK by CRVAX.SRI.COM with TCP; Mon, 16 OCT 89 11:34:24 PDT
Received: from ncdlab.ulcc.ac.uk by NSFnet-Relay.AC.UK   via Janet with NIFTP
           id aa10668; 16 Oct 89 17:16 BST
Date:           Mon, 16 Oct 89  17:23 BST
From: "Kevin Ashley - ULCC Networks Development." <KEVIN%ncdlab.ulcc.ac.uk@NSFnet-Relay.AC.UK>
To: INFO-VAX <@NSFnet-Relay.AC.UK:INFO-VAX@crvax.sri.com>
Subject:        LIBSEARCH SEARCH for VMS libraries 5/7

-+-+-+-+-+-+-+-+ START OF PART 5 -+-+-+-+-+-+-+-+
X`009TotMat = 0
X`009TotOut = 0
X`009Status = Lib$Init_Timer(TimCtx)
X`009Call StChek(Status)
X`009Return
X`009End
X
$ CALL UNPACK STATS.FOR;34 460656387
$ create/nolog 'f'
X*
X*`009All routines in here are concerned with maintaining the data
X*`009structures needed to support the /WINDOW qualifier.
X*`009I tried to do all this with dynamic strings, and dynamic buffers
X*`009to hold the pointers to the strings, but gave up. We allocate
X*`009fixed strings to hold the info now.
X*
X`009Subroutine Win_ini(Winbefore,Winafter,Window)
X`009Implicit None
X`009Integer Winbefore,Winafter
X`009Logical Window
X`009Integer Status
X`009Include 'WINDOW.INC'
X`009Integer I
X
X`009Totwin = 0
X`009If(.Not.Window .or. (Winbefore + Winafter .eq. 0)) Return
X
X`009Totwin = Winbefore + 1
X
X`009Do I = 1,Maxwin
X`009 Wlen(I) = -1
X`009Enddo
X
X`009Return
X`009End
X
X`009Subroutine Win_Fini
X*
X*`009Called at the start of each module to initialize window specific stuff.
X*
X`009Implicit None
X`009Include 'WINDOW.INC'
X
X`009If(Totwin .eq. 0) Return
X`009Cline = 0
X`009WBP = 0
X`009Return
X`009End
X
X`009Subroutine WinOut(Offset)
X*
X*`009Output the line at offset OFFSET from the current line
X*`009Offset may be negative or positive
X*`009It may also be illegal.
X*
X`009Implicit None
X`009Integer Offset
X`009Include 'WINDOW.INC'
X`009Integer LP
X
X`009If(Offset + Cline .le. 0) Return     !Window must wrap before start of f
Vile
X
X`009LP = WBP + Offset
X`009If(LP .LT. 1) LP = LP + Totwin
X`009Call Type_Rec(Windows(LP)(1:Wlen(LP)),Cline+Offset)
X`009Return
X`009End
X
X`009Integer Function GetRec(Filidx,Des)
X*
X*`009Grab the next record from the library, return its descriptor.
X*`009Our return code is a status code.
X*`009The record is stored in the window buffers.
X*
X`009Implicit None
X`009Include '($DSCDEF)'
X`009Integer Filidx
X`009Record /DSCDEF1/ Des,Tdes
X`009Integer Lbr$Get_Record,Status,Lib$Len
X`009Include 'WINDOW.INC'
X
X`009WBP = WBP + 1
X`009If(WBP .gt. Totwin) WBP = 1
X`009Status = Lbr$Get_Record(Filidx,Windows(WBP),TDes)
X`009If(Status) Then
X`009`009Cline = Cline + 1
X`009`009Wlen(WBP) = Lib$Len(Tdes)
X`009`009Des.Dsc$W_Maxstrlen = Wlen(WBP)
X`009`009Des.Dsc$A_pointer = %Loc(Windows(WBP))
X`009Endif
X
X`009GetRec = Status
X`009Return
X`009End
X
$ CALL UNPACK WINDOW.FOR;19 1007421174
$ create/nolog 'f'
X`009.TITLE FIND_FIRST - Fortran interface to STR$FIND_FIRST_SUBSTRING
X;
X;
X;`009This routine allows simple use of STR$FIND_FIRST_SUBSTRING
X;`009from FORTRAN, when the number of substrings to be used is not known
X;`009at compile time. The calling sequence is as for STR$FIND_FIRST_SUBSTRIN
VG
X;`009except that the last argument is replaced by a count of substrings,
X;`009and an array of descriptors for those substrings.
X;
X
X`009.Entry Str_Find_First_Substring,`094M<>
X
X`009Source = 4`009`009`009;String to search
X`009Pos    = 8`009`009`009;Position where target found
X`009Index  = 12`009`009`009;Index number of found string
X`009Ntargs = 16`009`009`009;Number of target strings
X`009Targets = 20`009`009`009;Address of descriptor array
X
X`009cmpl`009(ap),#5`009`009`009;Correct number of arguments ?
X`009beql`00910$`009`009`009;Yes
X`009movl`009#ss$_insfarg,r0`009`009;Nope, return now
X`009ret
X
X10$:`009movl`009@Ntargs(ap),r1`009`009;Get count of targets
X`009mull3`009#8,r1,r0`009`009;Compute offset to last descriptor
X`009addl2`009targets(ap),r0`009`009;Absolute address of last descriptor
X20$:`009pushaq`009-(r0)`009`009`009;Push the address of target n
X`009sobgtr`009r1,20$`009`009`009;Push all of them`009
X`009pushal`009@index(ap)`009`009;and address of word to return index
X`009pushal`009@pos(ap)`009`009;and address of word for position of hit
X`009pushaq`009@source(ap)`009`009;and address of source descriptor
X`009movl`009@ntargs(ap),r1`009`009;Get count of targets again
X`009addl2`009#3,r1`009`009`009;Add other arguments
X`009calls`009r1,G`094Str$Find_First_Substring
X`009Ret
X`009.end`009
$ CALL UNPACK FIND_FIRST.MAR;9 913002295
$ create/nolog 'f'
X*
X*`009Common block for library names, and current library name.
X*`009The Array Filnams holds the names as supplied by the user,
X*`009and Deftyps (not yet used) holds the default file types
X*`009to be applied to each file.
X*`009The array Excluded holds the names (if any) of files to exclude.
X*
X*`009Current_File holds the expanded filename of the current
X*`009library.
X*
X*`009Helplib is true if the current library is a help library
X*
X`009Integer Maxfiles
X`009Parameter (Maxfiles = 10)
X`009Character*160 Filnams(Maxfiles)          !Names of files to search
X`009Character*160 Excluded(Maxfiles)`009 !Files to exclude
X`009Integer Lexcl(Maxfiles)
X`009Integer Nexcl
X`009Character*3 Deftyps(Maxfiles)`009`009 !Default file types
X`009Character*(Lbr$C_MaxKeyLen) Modquals(MaxFiles),Cmodqual  !Modules
X`009Character*(Lbr$C_MaxkeyLen) Modexcl(Maxfiles)   !Excluded modules
X`009Integer Modqlen(Maxfiles),Cmodqlen       !Lengths of module names
X`009Integer Lmodexcl(Maxfiles)
X`009Integer Fnamlen(Maxfiles)                !Lengths of file names
X`009Character*256 Current_file`009`009!Expanded current filename
X`009Integer Cfilnaml
X`009Integer Nfiles,Cfile`009`009`009!Total files, current file
X`009Integer FilIdx`009`009`009`009!Library handle
X`009Logical Helplib
X
X`009Common /FILCOM/Nfiles,Cfile,Modquals,Modqlen,Filnams,FilIdx,
X     $    Deftyps,Fnamlen,Excluded,Lexcl,Nexcl,Modexcl,Lmodexcl,
X     $    Current_File,Cfilnaml,Cmodqual,Cmodqlen,Helplib
X
$ CALL UNPACK FILCOM.INC;14 1883120421
$ create/nolog 'f'
X`009Integer Lform(0:255)
X`009Character*5 Cform(0:255)
X`009Save Lform,Cform
X`009Data Lform/8*5,8*4,8*5,5,4,5,5,4*4,
X     $             88*1,7*1,5,
X     $             8*5,5*5,4,2*5,5*5,4,2*5,4*5,4,5,4,5,
X     $             5,7*1,80*1,7*1,5/
X
X`009Data Cform /
X     $ '<NUL>','<SOH>','<STX>','<ETX>','<EOT>','<ENQ>','<ACK>','<BEL>',
X     $ '<BS>','<HT>','<LF>','<VT>','<FF>','<CR>','<SO>','<SI>',
X     $ '<DLE>','<DC1>','<DC2>','<DC3>','<DC4>','<NAK>','<SYN>','<ETB>',
X     $ '<CAN>','<EM>','<SUB>','<ESC>','<FS>','<GS>','<RS>','<US>',
X     $ ' ','!','"','#','$','%','&','''',
X     $ '(',')','*','+',',','-','.','/',
X     $ '0','1','2','3','4','5','6','7',
X     $ '8','9',':',';','<','=','>','?',
X     $ '@','A','B','C','D','E','F','G',
X     $ 'H','I','J','K','L','M','N','O',
X     $ 'P','Q','R','S','T','U','V','W',
X     $ 'X','Y','Z','`091','\','`093','`094','_',
X     $ '`096','a','b','c','d','e','f','g',
X     $ 'h','i','j','k','l','m','n','o',
X     $ 'p','q','r','s','t','u','v','w',
X     $ 'x','y','z','`123','`124','`125','`126','<DEL>',
X     $ '<x80>','<x81>','<x82>','<x83>','<IND>','<NEL>','<SSA>','<ESA>',
X     $ '<HTS>','<HTJ>','<VTS>','<PLD>','<PLU>','<RI>','<SS2>','<SS3>',
X     $ '<DCS>','<PU1>','<PU2>','<STS>','<CCH>','<MW>','<SPA>','<EPA>',
X     $ '<x98>','<x99>','<x9A>','<CSI>','<ST>','<OSC>','<PM>','<APC>',
X     $ '<xA0>','`161','`162','`163','`164','`165','`166','`167',
X     $ '`168','`169','`170','`171','`172','`173','`174','`175',
X     $ '`176','`177','`178','`179','`180','`181','`182','`183',
X     $ '`184','`185','`186','`187','`188','`189','`190','`191',
X     $ '`192','`193','`194','`195','`196','`197','`198','`199',
X     $ '`200','`201','`202','`203','`204','`205','`206','`207',
X     $ '`208','`209','`210','`211','`212','`213','`214','`215',
X     $ '`216','`217','`218','`219','`220','`221','`222','`223',
X     $ '`224','`225','`226','`227','`228','`229','`230','`231',
X     $ '`232','`233','`234','`235','`236','`237','`238','`239',
X     $ '`240','`241','`242','`243','`244','`245','`246','`247',
X     $ '`248','`249','`250','`251','`252','`253','`254','<xFF>'/
$ CALL UNPACK FORMAT.INC;1 1644190120
$ create/nolog 'f'
X*
X*`009Common block describing user qualifiers
X*
X`009Integer Mxolen
X`009Parameter (Mxolen = 2048)
X`009Integer Match_Or,Match_And,Match_Nand,Match_Nor
X*
X*############### DO NOT CHANGE THE VALUE OF THESE PARAMETERS
X`009Parameter (Match_Or = 0,Match_And = 1)
X`009Parameter (Match_Nand = 2,Match_Nor = 3)
X*###############
X`009Character*16 Matchnams
X`009Parameter (Matchnams = 'OR  AND NANDNOR ')
X
X`009Integer FmtTxt,FmtDmp,FmtAll,FmtNul,Fmtnoff
X*############### DO NOT CHANGE THE VALUE OF THESE PARAMETERS
X`009Parameter (FmtTxt = 0,FmtDmp = 2,FmtAll = 1,FmtNul = 3)
X`009Parameter (Fmtnoff = 4)
X*###############
X`009Integer Hilite_None,Hilite_Bold,Hilite_Blink,Hilite_Rev
X`009Integer Hilite_Under,Hilite_Hunder,Hilite_Hover
X*############### DO NOT CHANGE THE VALUE OF THESE PARAMETERS
X`009Parameter (Hilite_None = 0,Hilite_Bold = 1,Hilite_Blink = 2)
X`009Parameter (Hilite_Rev = 3,Hilite_Under = 4,Hilite_Hunder = 5)
X`009Parameter (Hilite_Hover = 6)
X*###############
X`009Integer Created,Expired,Backup,Modified,Module_Time
X`009Integer Time_Type
X`009Parameter (Created = 0,Expired = 1, Backup = 2, Modified = 3)
X`009Parameter (Module_Time = -1)
X`009Integer Btime(2),Stime(2)
X`009Logical Before,Since
X`009Logical Remaining,Exact,Heading,Log,Statistics,Window,Numbers
X`009Logical Subtopic,Confirm,Confirm_Module
X`009Integer Winbefore,Winafter
X`009Integer Format,Match,Hilite
X`009Integer Outlun
X`009Common /QUALCOM/ Match,Remaining,Exact,Heading,Log,Statistics,
X     $                  Numbers,Window,WinBefore,WinAfter,Format,Outlun,
X     $                  Subtopic,Confirm,Confirm_Module,Hilite,
X     $                  Before,Since,Time_Type,Btime,Stime
$ CALL UNPACK QUALCOM.INC;17 1650346226
$ create/nolog 'f'
X*
X*`009Common block for statistics
X*
X`009Integer TotFil,Totrec,Totchr,Totmod,Totout,TotMat
X`009Integer Frec,Fmatch,Fmod,Fmodmatch
X`009Integer Recs,Matches,TimCtx
X`009Common/StatCom/TotFil,Totrec,Totchr,Totmod,Totout,TotMat,
X     $                 Frec,Fmatch,Fmod,Fmodmatch,
X     $                 Recs,Matches,TimCtx
$ CALL UNPACK STATCOM.INC;6 2047236663
$ create/nolog 'f'
X*
X*`009Common block for help subtopics
X*`009Topics and Ltopics keep track of proper, numbered topics and
X*`009qualifier topics.
X*
X`009Integer Maxtopic
X`009Parameter (Maxtopic = 9)
X`009Character*60 Topics(Maxtopic)
X`009Integer Ltopics(Maxtopic)
X`009Integer Ctopic
X`009Common/TOPICS/ CTopic,Topics,LTopics
$ CALL UNPACK TOPICS.INC;4 1748505475
$ create/nolog 'f'
X*
X*`009Define descriptors for dynamic strings which reference
X*`009targets
X*
X`009Include '($dscdef)'
X`009Integer Maxtarget
X`009Parameter (MaxTarget = 100)
X`009Record /dscdef1/ Target(Maxtarget)
X
X`009Integer Ntargets
X
X`009Common/TRGCOM/Ntargets,Target
X
$ CALL UNPACK TRGCOM.INC;4 303520634
$ create/nolog 'f'
X*
X*`009Common blocks, etc for window buffers
X*
X`009Integer Maxwin
X`009Parameter (Maxwin = 51)
X`009Integer Totwin`009`009`009`009!Total window lines
X`009Integer Cline`009`009`009`009!Current line number
X`009Integer WBP`009`009`009`009!Window buffer pointer
X`009Include '($lbrdef)'
X`009Character*(LBR$C_MAXRECSIZ) Windows(Maxwin)
X`009Integer Wlen(Maxwin)
X`009Common /WINCOM/ Totwin,Cline,WBP,Wlen,Windows
X
$ CALL UNPACK WINDOW.INC;5 1631416373
$ create/nolog 'f'
X$ @COMPILE
X$ LINK/NOTRACEBACK @LINK
$ CALL UNPACK BUILD.COM;1 101520789
$ create/nolog 'f'
X    LIBSEARCH,OUTPUT,PRSCOM,PRSFIL,PRSTARGET,SEARCH_MODULE,STATS,Window,-
X    FIND_FIRST,LIBSEARCHMSG,LIBSEARCH_CMD
$ CALL UNPACK LINK.COM;10 1115376999
$ create/nolog 'f'
X$ FORTRAN 'CSWIT' LIBSEARCH.FOR
X$ FORTRAN 'CSWIT' OUTPUT.FOR
X$ FORTRAN 'CSWIT' PRSCOM.FOR
X$ FORTRAN 'CSWIT' PRSFIL.FOR
X$ FORTRAN 'CSWIT' PRSTARGET.FOR
X$ FORTRAN 'CSWIT' SEARCH_MODULE.FOR
X$ FORTRAN 'CSWIT' STATS.FOR
X$ FORTRAN 'CSWIT' WINDOW.FOR
X$ MACRO FIND_FIRST
X$ MESSAGE LIBSEARCHMSG
X$ SET COMMAND/OBJECT=LIBSEARCH_CMD LIBSEARCH.CLD
$ CALL UNPACK COMPILE.COM;9 1059347678
$ create/nolog 'f'
X1 LIBSEARCH
XLIBSEARCH is a program which duplicates the functions of the VMS SEARCH
Xcommand, but acts instead on text,macro or help libraries on a module-by-
X-module basis. Amongst other things, LIBSEARCH makes it easy to find help
Xtext when you know the word that you want help with (e.g. compare) but
Xdon't know what HELP topic to look in for it (DIFFERENCES, in this case.)
X
XIt also makes it much easier to find which module in a macro or include
Xlibrary defines which symbol, just by using LIBSEARCH to search for the
Xsymbol name.
X
XLIBSEARCH takes arguments which, as much as possible, are the same as those
Xfor SEARCH, and produces output which looks very similar. The restrictions
Xand additions are documented below.
X
XFormat
X LIBSEARCH library-spec,... search-string,...
X`032
X2 Parameters
Xlibrary-spec`091,...`093
X
X Specification(s) of library(s) to be searched. Wild card characters are
X allowed. Only text,macro or help libraries can be searched. The filetype
X will be defaulted appropriately if the /HELP,/MACRO or /TEXT qualifiers
X are used. /HELP is assumed if no qualifier is present. Separate multiple
X filenames with commas.
X
Xsearch-string`091,...`093
X
X Character string to be located. Enclose strings containing lowercase
X letters, blanks or other nonalphanumeric characters in quotation marks.
X Up to 100 search strings may be specified, and there is no explicit limit
X on the length of strings. A limit is imposed, however, by DCL on the
X maximum length of the total command. You can use the /MATCH and /EXACT
X qualifiers to alter the way LIBSEARCH matches text strings.
X2 Restrictions
XThe /EXCLUDE qualifier, to exclude specific files, is not yet available.
X
XOnly 10 different input file specifications may be supplied, although
Xall can use wildcards to match an unrestricted number of files.
X
XAll other restrictions are also present in SEARCH.
X
X2 Release_Notes
X3 V1.4
XVersion 1.4 of LIBSEARCH incorporates a number of additional facilities
Xand corrects a number of problems with LIBSEARCH. Thanks are due to Pat
XRankin for providing helpful suggestions and code.
X
XV1.4 supports most of the qualifiers for SEARCH new with version 5.
XIn particular, highlighting is supported, exclusion of files or
Xmodules based on dates and times, and the /CONFIRM switch is present.
X
XHandling of the /WINDOW parameter has been corrected to be identical
Xto SEARCH. Modules with numeric subtopics are correctly handled, as are
Xthose with lines starting with numeric data. When searching help
Xlibraries, the subtopic location is also provided.
X
XThe HELP qualifier is assumed by default. Trailing spaces are trimmed on
+-+-+-+-+-+-+-+-  END  OF PART 5 +-+-+-+-+-+-+-+-

