Storedon:{Phylum}Library>SINGLEFILEINDEX.TeditProgram:{Phylum}Library>SINGLEFILEINDEX.DCOMDocumentationrevised:February27,1984;andMay16,1984SINGLEFILEINDEXChristopherTongandJonL.WhiteSINGLEFILEINDEXisaLispLibrarypackageforgeneratingindexedlistingsforfiles.Itsfeaturesinclude:1.Itemsthatareindexedbytype(e.g.FNS,VARS,etc.)andthepagenumberonwhichtheirdefinitionsappearinthelisting;2.Theabilitytodefinethetypestobeindexed,aswellasthemeansforlocatingdefinitionsofaparticulartype;3.InINTERLISP-D,thelistingiscreatedinabackgroundprocess;4.Ihecreationofanmulti-typeindexformultiplefiles.1.Creatingindexedfilelistings.SINGLEFILEINDEXlistsafile,producingindicesfordifferenttypesofitemsthatappearonthatfile.Thesetypesareusuallyfilepackagetypes,buttheyneedn'tbe.1Adefaultsetoftypespecificationsisprovidedbythevalueofthevariable,DEFAULTINDEXEDTYPESLST:((VAR(RPAQADDTOVAR)TestForVar)(MACROPUTPROPSTestForMacro)(CONSTANTSCONSTANTSTestForCOnstants)(RECORD{indirectsthroughvariableCLISPRECORDTYPES})(RESOURCEPUTDEFTestForGenericDefinition)(BITMAP"RPAQ"TestForBitmap)(CLASS"DEFCLASS")(INSTANCEDEFINSTTestForInstance)(METHODMETHTestForMethod))TheusercanspecifythetypeshewantstoindexwiththevariableINDEXEDTYPESLST,whichisinitiallysettothevalueofDEFAULTINDEXEDTYPESLST.p c/ aqp+1SIrSI6DSI P P M:tw"(/Q2 :M@FPHHM: JJrJJ eGt/",%)O-3669<@FHHG Dwe S$&U(-DwrDw-Dw eAt<!%'*026:8:; @&BHHA ?-  !9$?-r?-$?- e%CF ,q-cF,t,G#HH, *1/i- &I(0Y3l6< >BYHH*1 'vd't'' %&w B B%&x%& D FR^#r .%& " egu +" ? eg }#4 ?  eguwQQy #0(5q((v5y6w7> Mx eg{8M  egw , i egu!i  eg{ 0  egw )  em t e" x$2)],25:n?BHH vt&8) +V.w3#5}5}vGtHH q?[Functionsarealwaysindexed,andshouldnotbeincludedinINDEXEDTYPESLST.Seesection2formoreonspecifyingtypes.ThetwofunctionsresponsibleforcreatingindexedlistingsareSINGLEFILEINDEXandMERGEDFILEINDEX.(SINGLEFILEINDEXFILEOUTPUTFILEMERGEDINDEXFLG)[Function]FILEisthelispsourcefile.OUTPUTFILEisthedestinationfile.IfOUTPUTFILE=NIL,thenthevalueofPRINTER(initiallyLPT:)isused.MERGEDINDEXFLG=Tmeansasingle,alpabeticallysortedindexwillbecreatedforallthetypes(insteadofaseveraltype-specificindices).ThevalueofFILELINELENGTHdeterminesthepositionoftheindexnumbers,aswellastheplacementofthecolumns.ThevalueofLINESPERPAGE(initially65onDmachines,58otherwise)determinesthenumberoflinesperpage.SINGLEFILEINDEXfirstprintsthefile,withthefilenameandpagenumberatthetopofeverypage,aswellasthenameofanydefinitionwhoselistinghasbeeninterruptedbythepagebreak.Afterthefilehasbeenprinted,thesubsequentpageslisttheindexorindices(dependingonthevalueofMERGEDINDEXFLG).Thefirstpageprovidesthefilename,timeofcreation,andtimeoflisting.IfMERGEDINDEXFLG=T,theorderinwhichtheindicesappearisdeterminedbytheorderofthetypesinINDEXEDTYPESLIST.Iftherearenoitemsofaparticulartypeonthefile,noindexisgenerated.1Theindexforitemsofaparticulartypeprovidesthenamesofthoseitems,aswellasthepagenumberonwhichtheirdefinitionbegins.Theindexissortedbyitemname.WhentheSINGLEFILEINDEXpackageisfirstloaded,itredefinesLISTFILES1(seetheINTERLISPmanual)sothatallfileslistedbyLISTFILESwillbelistedusingthefunctionSINGLEFILEINDEX.2Thefilebeingindexedneedn'tbeloaded,orevennoticed(inthefilepackagesense).(MERGEDFILEINDEXFILES)[Function]MERGEDFILEINDEXcreatesasingleindexforasetoffiles,FILES.Theindexcontainsthenameofafileitem,itstype,andthefileonwhichitappears.Theindexisalphabeticallysortedbyitemname.Ifthesameitemofaparticulartype c8 `tss`z``t`!`$*- /f618=8=`v`D`t`EHH` ^38t5 !%^3 Z er U */7>F6HHZ XKV0X Sx  S{Sd (( 5SxS6SzS77StS: LtLLvLjLtL7"&^+.Z.ZLvL4;LtL5 <BFHHGFDv DtDE $'-/27W>@D F'HHDANE%).1414AvA ;HAtA>>D?W ; e!w&3),j0+3 9=$AGHH; 8f r!|#&w+-%0[ 7=ADHH8f 5 Y5 $'*I- 069 AFQHH5 3 ~ #N%(-b//3{3 @D3HH( %b qg"&* 28;@$AFHH%b "x" D e>%+-p068 ? HHD &^ "%(%+/2 ;>#@YDHH  $Mq9$t%k(+U/5;n=C&EHH 3H" x ts{x t!=#&3(+)-0257: < CrCbt!&(,03m478<<b{b@]btbA8DtHHb @pm #')-0368=?9EHH  9 $&*z/003t7q;<> ETHH  q?[kappearsonseveralfiles,aseparateindexentrywillbegeneratedforeachoccurence.2.SpecifyingtypesForthepurposeofthispackage,atypeisdefinedasalistoffouritems:1.Thenameofthetype(e.g.BITMAP);2.Acandidate-generatingstringorlistofstrings(e.g.RPAQand"RPAQ");3.Afunctionforascertainingwhetheralinedefinesanitemofthistype;4.Anon-nullflagifthetypedefinitionisambiguouswithanothertype;Thetypenameshouldberecognizablebythefilepackage;ifitisn'trecognized,thentheassumptionismadethatitemsofthistypearedeclaredintheFILECOMSofanyfiletobeprocessedbyawordthatisthepluralofthetypename(e.g.thefilepkgcomscommandtooutputaBITMAPisjustBITMAPS,andthattooutputaLOOPSCLASSisjustCLASSES).Thecandidate-generatingstringmustfollowa"("or"["atthebeginningofalineonthefile(litatomsareacceptableasstrings).Ifalistofstringsisprovided(e.g.forRECORDs),amatchagainstanyoneofthemwillproduceacandidateline.(Note:thecandidate-generatingstringwillbeusedforpartialmatching;thusRPAQwillmatchRPAQ,RPAQQ,andRPAQ?,but"RPAQ"willmatchonlyRPAQ.)SINGLEFILEINDEXreadsthefile,onelineatatime,andcompareseachlineagainstthecandidate-generatingstringorstringsforeachtype;ifacandidatelineisfound,thetestfunctionisappliedwitharguments.Thetestfunctionhasarguments:(stringtypeName),andreturnseitherNIL(i.e.thecandidatelineisnotalegitimateinstanceofthiskindofdefinition)orthenameoftheitembeingdefined.Theargumentstringconsistsofthecharactersofthecurrentline,beginningwherethecandidate-generatingstringwasfound,uptoandincludingtheend-of-linecharacter(s).Theambiguityflagmeansthatagivenlinecouldtestpositivefortwoormoretypes;ordinarily,atmostonetypewilltestpositive.ThetestsforCONSTANTSandVARSarespecificallytryingtoexcludeoneanother,sothatonewon'tgetaconstantindexedbothasaVARandasaCONSTANT.Althoughtherearenoinstancesofthisflaginthe c8`t,"$h+/4g7:qB<E,HH`^J _^JZqrZq Wu HWzWW Stt ve!##StzSt%SttSt&S'-/c00StSt3 48I< StSt{BGrGBG D|t ev *V,/29o;<@W HHD| AI i#'I):,A/2w8:=FH_AAHHA ?2 q?2?2[t9 "'*,/47O:qBEF(HH?2 < W/"V##6CKEHH& #Ai $$!# s e{ $% s| s* sw s** s| s1 st s360;@$@$ sv sB st sCF'HH s 7U "m(*-1F35 ;+='?D:F(HH ##|(t)i/513 ;@="?EVHH usD*B.17<9;>F'HHu  ( +1 W e) #6$f(+/28;->+@D&HHW  "%,k- 0s466v>Zt>B:B:vEtF5HH ]"](*-05 78?EHH h ! hv h? ht hYY hv h  ht h!L" ).13:=#@}CF'HH h q?[DEFAULTINDEXEDTYPESLST,itmayariseinuser-definedtypes.Asanexampleoftestfunctionsetc.,supposethereisalineinthefile:(RPAQFooNIL)ThentheRPAQfollowinganinitial"("makesthislineacandidateforthebeginningofabitmapdefinition.However,whenTestForBitmapisappliedto"RPAQFooNIL)"itrejectsthiscandidatebecausethesecondexpressionaftertheRPAQisnot(READBITMAP).Additionally,thislineisacandidateforforaVARdefinition,butthetestfunctionTestForVarmightrejectitifFooisnotcontainedintheFILECOMSasaVARS.(Thishoweverisnotthekindofambiguitysignalledbythefourthitemofatype;itismerelyambiguityatthecandidatelevel).Twofunctionsareprovidedtoaidinsomeverycommonparadigmsfordefinitionalformats:(1)whenthedefinitionismadebyacalltoPUTDEFinthefile,thentheteststringshouldjustbePUTDEFandthetestfunctionshouldbeTestForGenericDefinition;thistestisabitmorecomplicatedthanwouldordinarlyberequired,becauseitmayrequirescanningthenextcoupleoflinestofindtheargumentstothePUTDEF(i.e.,thestringargumenttothetestfunctiondoesn'tcontainenoughofthefiletomakethedecision).(2)whenthenameoftheitembeingdefinedappearsasthefirsts-expressionafterthecandidate-generatingstring,thethetestfunctionTestForTypeisadequate;infact,ifnotestfunctionisprovidedinthetype,thenTestForTypewillbeused.AfewvariablesareboundasSPECVARSsothatusers'testfunctionsmayaccessimportantpartsofstate.ThefilebeingindexedisopenedforinputandFULLSisastreamintoit.ItisoftenusefultoscreencandidatesofaparticulartypeagainstthelistofallitemsofthattypeasfoundontheFILECOMSofthefile--forthispurpose,thevariable,typeNames,isboundtoalistwhosemembershavetheform:(typeNameitemList)whereitemLististhelistofnamesaswouldbereturnedbyINFILECOMS?. c8 `vd`t`6#&(t 15` ]v e#&-12368;:>]v Y* eY*vY*FY*tY*Y* TTvTTtT~#0%*-019$;>FEGHHT R9e .w##R9vR9 .R9tR9/(06r8P9#R9vR9=g@D0R9|R9GR9tR9HHR9 O %=(. 7V;?5?5OvOBOtOCF HHO Lv LtL8 "%'[(/2:455LvL8gLtL8 @CREHHL JJFFJJvJJ JJtJJJJzJJJJtJJ"$9%%JJvJJ(3JJtJJ(*#,4:6 8ACEEJJvJJH`JJtJJHHJJ G <YR!m#S*136x;\>@BBGzGDGtGEGLHHG D+d#='D AY e!f#>%'+/O5=@< HHAY >@F> :h I' x!?#j$'p)>)>:hv:h.H:ht:h.03"689 G/ + ap!&%+s1`3F69J BfF'HH+ (!!$2' -c-c(v( 6(t(7 8?AE!FHH( &> S  &>z&>#&>t&>$k''&>v&> 17&>t&>146:f&> ! e 1 2!!!v!(!t!+)-B05-84?\BGG! 65!b$X(/F1 69>,AA6v6E6t6FGHH6 S-@!#(o 0U2>3| :>DCFQHH   L;v"$'0258b:<?F(HH GYYGvGGtG7 8"#4%*v1_57;G  ewY|wii|!wt 2| t*H$&L+-4355v ?t? T Tm q?[Note1:BothSINGLEFILEINDEXandMERGEDFILEINDEXrunasbackgroundprocessesinINTERLISP-D.Note2:Thefilesbeingindexedand/orlistedneedn'tbeloaded.Note3:ThecurrentversionoftheSINGLEFILEINDEXpackagereplacesanolderversionwhichonlyindexedfunctions,usedrelativelabelsinsteadofabsolutepagenumbers,andprintedthefunctionindexbeforelistingthefile.SettingRELATIVEINDEXFLGtoTwillrestorethisbehavior,ifsodesired(e.g.ifyouareprintingonfanfoldpaperratherthancutsheets,youmaywanttheindextoappearbeforethefilelisting).IfRELATIVEINDEXFLGisNIL(thecurrentdefault),indexingwillbeasdescribedabove,andtheindiceswillbeprintedafterthefileislisted.If,forsomereason,bothkindsofindexingaredesired,giveRELATIVEINDEXFLGthevalueBOTH.Note4:TheSINGLEFILEINDEXpackageusesthefollowingvariables:FILELINELENGTHtodotheright-justificationandcolumnating;PRINTER(defaultvalueisLPT:)asthefiletoopentoprinttheindexedversionofthefile;LINESPERPAGE(initially65onDmachines,58otherwise)asthenumberoflinesontheprinter.ThedefaultvaluesareonlyusedifthevariableswerenotboundatthetimeSINGLEFILEINDEXwasloaded.1Ifthetypeisafilepackagetype,andtherearenoitemsofthattypeonthefile(accordingtotheFILECOMS),thenthefileisneversearchedforitemsofthattype.2withOUTPUTFILEandMERGEDINDEXFLGsettoNIL. c8 _Ht _H ZzQZtZ%(:=? HHZ X@ X@ SzStS|L!T&*027S OzVOtOw> " %5<BWDHHO L '+16x<;>oEHHL J0'k6")/05\;D?ClHHJ0 GvZGtGGvGGtG!8$'.072:7;V<@BHHG D D~E"'+ .25Q9;AF'HHD BAGddBAvBA#BAtBA$&&BAvBA)JBAtBA*8-3:ADFHHBA ?a#&)E/#/#?z?2W?t?358:?ADHH? <R4 #,),c,cLIBRARY>SINGLEFILEINDEX.TEDIT;5JONL.PA17-May-84 02:40:19