Google
 

Trailing-Edge - PDP-10 Archives - -
There are no other files named in the archive.
(FILECREATED "28-May-81 08:37:09" <GREENFELD>FILEINDEX..19 10747  


     changes to:  FILEINDEX

     previous date: "25-Nov-80 18:33:38" <GREENFELD>FILEINDEX..18)


(PRETTYCOMPRINT FILEINDEXCOMS)

(RPAQQ FILEINDEXCOMS ((FNS FILEINDEX PRINTINDEX PRINTINDEXHEADER COLUMNATE 
			   CREATEHEADERLINE DOTS MAKEDOTS)
		      [P (OR (BOUNDP (QUOTE LINESPERPAGE))
			     (SETQ LINESPERPAGE 58))
			 (OR (BOUNDP (QUOTE PRINTER))
			     (SETQ PRINTER (QUOTE LPT:]
		      (VARS (INDEXFORMAT 50331648)
			    (100DOTS 

"...................................................................................................."
				     ))
		      (* LISP information)
		      (FILES (SYSLOAD FROM LISPUSERS)
			     CIALPHORDER)
		      (DECLARE: EVAL@COMPILE DONTCOPY
				(FILES (SYSLOAD SOURCE FROM LISPUSERS)
				       COMMONFILEINDEX))
		      (DECLARE: EVAL@COMPILE DONTCOPY
				(P (RESETSAVE DWIMIFYCOMPFLG T)))
		      (DECLARE: EVAL@COMPILE DONTCOPY
				(RECORDS DefineqList FileMap FnPointer 
					 IndexLineRecord))
		      (BLOCKS (FILEINDEXBLOCK (ENTRIES FILEINDEX)
					      (LOCALFREEVARS LINENUMBER 
							     PAGENUMBER 
							    INDEXNUMBER 
							     INDEXFILE 
							  CURRENTFNNAME)
					      (SPECVARS FILELINELENGTH 
							LINESPERPAGE 
							PRINTER)
					      (GLOBALVARS 100SPACES 100DOTS 
							  INDEXFORMAT)
					      FILEINDEX PRINTINDEX 
					      PRINTINDEXHEADER COLUMNATE 
					      MAKEINDEXNUMBER MAKESPACES 
					      DOTS MAKEDOTS NEWLINE NEWPAGE 
					      TESTPAGE BOLDPRIN1 FCONCAT 
					      ODDP CREATEHEADERLINE))))
(DEFINEQ

(FILEINDEX
  [LAMBDA (FILELST OUTPUTFILE)               (* N.Greenfeld "28-May-81 08:36"
)

    (* Makes an index file (default is to the line printer) The 
    index file will have a table of contents which will list all 
    the functions in alphabetical order and a sequence number of 
    where that function is in the files.)



    (* * NOTE: if successful it returns the list of full filenames
    for FILELST otherwise NIL.)


    (PROG (fileMap indexFileFullName indexFileFullNameList outFile
		   (indexList (<NIL>))
		   (maxFnNameWidth 0)
		   (maxIndexLineWidth 0)
		   (maxIndexWidth 0)
		   indexNum
		   (LINENUMBER 0)
		   (PAGENUMBER 1)
		   (INDEXNUMBER 0)
		   CURRENTFNNAME INDEXFILE indexFileShortName 
		   indexFileShortNameList indexFileShortNameWidth)
          (for FILE in FILELST
	     do (if indexFileFullName_(FINDFILE FILE)
		    then indexFileFullName_(OPENFILE indexFileFullName 
						     'INPUT))
		(if ~indexFileFullName
		    then (printout T "Failed to open input file: " FILE T)
			 (GO $$OUT))
		(if ~(fileMap_(GETFILEMAP indexFileFullName))
		    then (printout T "Could not get file map for file: " 
				   indexFileFullName T)
			 (CLOSEF? indexFileFullName)
			 (GO $$OUT)
		  else fileMap_fileMap:Maps)
		(indexFileShortName_(PACKFILENAME 'NAME
						  (FILENAMEFIELD 
						      indexFileFullName 
								 'NAME)
						  'EXTENSION
						  (FILENAMEFIELD 
						      indexFileFullName 
							     'EXTENSION)))
		(indexNum_0)
		[RESETFORM
		  (RADIX 10)
		  indexFileShortNameWidth_(NCHARS indexFileShortName T)
		  (LCONC indexList
			 (for DefineqBlock in fileMap
			    join (for fnPointer in DefineqBlock:FnsList
				    collect (maxFnNameWidth_(IMAX
						maxFnNameWidth
						(NCHARS fnPointer:FnName T))
					      )
					    (indexNum_indexNum+1)
					    (create IndexLineRecord
						    ILFnName _ 
						    fnPointer:FnName
						    ILNum _ indexNum
						    ILFileName _ 
						    indexFileShortName]
		(maxIndexWidth_(IMAX maxIndexWidth indexFileShortNameWidth+(
				       NCHARS indexNum)+ 1))
		(maxIndexLineWidth_(IMAX maxIndexLineWidth 
					 maxIndexWidth+maxFnNameWidth+1))
		(indexFileFullNameList_ < !! indexFileFullNameList 
					  indexFileFullName>)
		(indexFileShortNameList_ < !! indexFileShortNameList 
					   indexFileShortName>)
		(CLOSEF? indexFileFullName))
          (if indexFileFullNameList=NIL
	      then                           (* no files could be found)
		   (RETURN NIL))
          (if outFile_(OUTFILEP (if OUTPUTFILE
				  else PRINTER))
	      then outFile_(OPENFILE outFile 'OUTPUT))
          (if ~outFile
	      then (printout T "Failed to open output file: " OUTPUTFILE T)
		   (RETURN NIL))
          (INDEXFILE_(CREATEHEADERLINE indexFileShortNameList))
          (NLSETQ (RESETLST (RESETSAVE (RADIX 10))
			    (RESETSAVE (OUTFILE outFile))
			    (RESETSAVE (LINELENGTH FILELINELENGTH))
			    (PRINTINDEXHEADER indexFileFullNameList)
			    (PRINTINDEX indexList:1 maxIndexLineWidth 
					maxIndexWidth)))
          (CLOSEF? outFile)
          (RETURN indexFileFullNameList])

(PRINTINDEX
  [LAMBDA (indexList maxIndexLineWidth maxIndexWidth)
    (DECLARE (USEDFREE LINENUMBER $$LST1))   (* Edited by N.Greenfeld on 
					     25-Nov-80.)
    (bind (columnWidth _(IPLUS maxIndexLineWidth 3))
	  [pageColumns _(SORT indexList (FUNCTION (LAMBDA (.X. .Y.)
				  (CIALPHORDER .X.:ILFnName .Y.:ILFnName]
	  columnsPerPage leftOver interFnSpacing
       first (if pageColumns=NIL
		 then (NEWLINE)
		      (BOLDPRIN1 "No Functions.")
		      (NEWPAGE T)
		      (RETURN))
	     (columnsPerPage_FILELINELENGTH/(columnWidth+2))
	     (leftOver_FILELINELENGTH-(columnWidth+2)*columnsPerPage)
	     (columnWidth_columnWidth+leftOver/2/columnsPerPage) 
                                             (* half the leftOver goes to 
					     DOTS)
	     (interFnSpacing_(if columnsPerPage gt 1
				 then leftOver/2/(columnsPerPage-1)+ 2
			       else 2))
       do (COLUMNATE pageColumns columnsPerPage LINESPERPAGE-LINENUMBER)
	  (for indexLine in pageColumns:1
	     do (bind dummyVar for fnItem in indexLine
		   do (PRIN4 fnItem:ILFnName)
		      (DOTS columnWidth-(NCHARS fnItem:ILFnName T)
			    -maxIndexWidth)
		      (PRIN4 fnItem:ILFileName)
		      (SPACES maxIndexWidth-((NCHARS fnItem:ILFileName T)+(
				 NCHARS fnItem:ILNum)))
		      (PRIN3 fnItem:ILNum)
		      (if $$LST1::1
			  then (SPACES interFnSpacing)))
		(NEWLINE))
	  (if pageColumns::1
	      then (NEWPAGE))
       repeatwhile pageColumns_pageColumns::1])

(PRINTINDEXHEADER
  [LAMBDA (fileNameList)                     (* Edited by N.Greenfeld on 
					     25-Nov-80.)
    (PROG (headerStr (maxFileNameLength 0)
		     fileNameIndent writeDateIndent date)
          (headerStr_(CONCAT "-- Indexed on " date_(L-CASE (DATE 
							    INDEXFORMAT)
							   T)
			     " --"))
          (TAB (FILELINELENGTH-(NCHARS headerStr))/2 NIL)
          (PRIN1 headerStr)
          (NEWLINE)
          (for fileName in fileNameList bind len_0
	     do maxFileNameLength_(IMAX maxFileNameLength (NCHARS fileName))
	       )
          (fileNameIndent_(FILELINELENGTH-(maxFileNameLength+(NCHARS date)+ 
		2))/2)
          (writeDateIndent_fileNameIndent+maxFileNameLength+2)
          (for fileName in fileNameList
	     do (TAB fileNameIndent NIL)
		(PRIN1 fileName)
		(TAB writeDateIndent NIL)
		(PRIN1 (L-CASE (GDATE (GETFILEINFO fileName 'IWRITEDATE)
				      INDEXFORMAT)
			       T))
		(NEWLINE))
          (NEWLINE])

(COLUMNATE
  [LAMBDA (lst columnsPerLine linesPerPage)     (* Edited by M.Yonke on 
						2-Jan-79.)

          (* lst is a simple list. The value returned is the 
	  original list smashed into the following structure: 
	  (a b c d e f g h i j) becomes 
	  (((a c e) (b d f)) g h i j) when Perline = 2 and 
	  linesPerPage = 3)


    (COND
      (lst (PROG (tail 1sttail lasttail)
	         [for old tail on lst as i from 1 to linesPerPage
		    do (SETQ 1sttail tail)
		       (RPLACA tail (LIST (CAR tail]
	         (SETQ lasttail (CDR 1sttail))
	         (for j from 2 to columnsPerLine
		    do (for orig in lst as i from 1 to linesPerPage
			  do (SETQ tail lasttail)
			     (SETQ lasttail (CDR lasttail))
			     (RPLACD tail NIL)
			     (NCONC orig tail)))
	         (RPLACD 1sttail NIL)
	         (RPLACA lst (CONS (CAR lst)
				   (CDR lst)))
	         (RPLACD lst lasttail)
	         (RETURN lst])

(CREATEHEADERLINE
  [LAMBDA (fileList)                         (* Edited by N.Greenfeld on 
					     20-Oct-80.)

    (* Sets up the string that NEWPAGE will print in the middle of
    the header line at the top of each new page.)


    (PROG ((maxlen (FILELINELENGTH-22))
	   proposedList)
          (for file in fileList::1 first proposedList_ <fileList:1>
	     do proposedList_ <file ", " ! proposedList>)
          (proposedList_(APPLY (FUNCTION CONCAT)
			       (DREVERSE proposedList)))
          (if (NCHARS proposedList) gt maxlen
	      then (until pos=NIL or pos gt maxlen bind pos_1
							lastpos
		      do (lastpos_pos)
			 (pos_(STRPOS ", " proposedList pos NIL NIL T))
		      finally proposedList_(CONCAT (SUBSTRING proposedList 
							      1 lastpos-1)
						   "...")))
          (RETURN proposedList])

(DOTS
  [LAMBDA (n)                                   (* Edited by M.Yonke on 
						18-Jan-79.)
    (PRIN3 (MAKEDOTS n])

(MAKEDOTS
  [LAMBDA (n)                                   (* Edited by M.Yonke on 
						18-Jan-79.)
    (COND
      ((ZEROP n)
	"")
      ((ILEQ n 100)
	(SUBSTRING 100DOTS 1 n))
      (T (CONCAT 100DOTS (MAKEDOTS (IDIFFERENCE n 100])
)
(OR (BOUNDP (QUOTE LINESPERPAGE))
    (SETQ LINESPERPAGE 58))
(OR (BOUNDP (QUOTE PRINTER))
    (SETQ PRINTER (QUOTE LPT:)))

(RPAQ INDEXFORMAT 50331648)

(RPAQ 100DOTS 

"...................................................................................................."
)
[DECLARE: DONTEVAL@LOAD DONTCOPY
(* LISP information)  ]

(FILESLOAD (SYSLOAD FROM LISPUSERS)
	   CIALPHORDER)
(DECLARE: EVAL@COMPILE DONTCOPY 
(FILESLOAD (SYSLOAD SOURCE FROM LISPUSERS)
	   COMMONFILEINDEX)
)
(DECLARE: EVAL@COMPILE DONTCOPY 
(RESETSAVE DWIMIFYCOMPFLG T)
)
(DECLARE: EVAL@COMPILE DONTCOPY 
[DECLARE: EVAL@COMPILE 

(RECORD DefineqList (BeginPoint EndPoint . FnsList))

(RECORD FileMap (NIL . Maps))

(RECORD FnPointer (FnName BeginPoint . EndPoint))

(RECORD IndexLineRecord (ILFnName ILFileName ILNum))
]
)
[DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY
(BLOCK: FILEINDEXBLOCK (ENTRIES FILEINDEX)
	(LOCALFREEVARS LINENUMBER PAGENUMBER INDEXNUMBER INDEXFILE 
		       CURRENTFNNAME)
	(SPECVARS FILELINELENGTH LINESPERPAGE PRINTER)
	(GLOBALVARS 100SPACES 100DOTS INDEXFORMAT)
	FILEINDEX PRINTINDEX PRINTINDEXHEADER COLUMNATE MAKEINDEXNUMBER 
	MAKESPACES DOTS MAKEDOTS NEWLINE NEWPAGE TESTPAGE BOLDPRIN1 FCONCAT 
	ODDP CREATEHEADERLINE)
]
(DECLARE: DONTCOPY
  (FILEMAP (NIL (1617 9447 (FILEINDEX 1629 . 4808) (PRINTINDEX 4812 . 6292) (
PRINTINDEXHEADER 6296 . 7278) (COLUMNATE 7282 . 8218) (CREATEHEADERLINE 8222
 . 9070) (DOTS 9074 . 9198) (MAKEDOTS 9202 . 9444)))))
STOP