From 54bea56b8161abdf9261cbf133b3c7cf3cac488b Mon Sep 17 00:00:00 2001 From: rmkaplan <69548581+rmkaplan@users.noreply.github.com> Date: Tue, 25 Jun 2024 20:36:09 -0700 Subject: [PATCH] Extra argument to COMPAREDIRECTORIES to specify directory names (#1766) Allow smaller headers for GITFNS browser --- lispusers/COMPAREDIRECTORIES | 57 ++++++------ lispusers/COMPAREDIRECTORIES.LCOM | Bin 41268 -> 41295 bytes lispusers/COMPAREDIRECTORIES.TEDIT | 140 +++++++++++++++++++++++++++-- 3 files changed, 163 insertions(+), 34 deletions(-) diff --git a/lispusers/COMPAREDIRECTORIES b/lispusers/COMPAREDIRECTORIES index d8b23f7a..de95802d 100644 --- a/lispusers/COMPAREDIRECTORIES +++ b/lispusers/COMPAREDIRECTORIES @@ -1,12 +1,12 @@ (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10) -(FILECREATED "26-Mar-2024 21:42:47" {WMEDLEY}COMPAREDIRECTORIES.;259 131082 +(FILECREATED " 1-May-2024 14:53:20" {WMEDLEY}COMPAREDIRECTORIES.;260 131326 :EDIT-BY rmk - :CHANGES-TO (FNS FIX-DIRECTORY-DATES) + :CHANGES-TO (FNS COMPAREDIRECTORIES) - :PREVIOUS-DATE "29-Sep-2023 17:25:57" {WMEDLEY}COMPAREDIRECTORIES.;257) + :PREVIOUS-DATE "26-Mar-2024 21:42:47" {WMEDLEY}COMPAREDIRECTORIES.;259) (PRETTYCOMPRINT COMPAREDIRECTORIESCOMS) @@ -63,7 +63,8 @@ (COMPAREDIRECTORIES [LAMBDA (DIR1 DIR2 SELECT INCLUDEDFILES EXCLUDEDFILES USEDIRECTORYDATE OUTPUTFILE ALLVERSIONS - FIXDIRECTORYDATES) (* ; "Edited 29-Sep-2023 17:25 by rmk") + FIXDIRECTORYDATES SHORTDIRNAMES) (* ; "Edited 1-May-2024 14:52 by rmk") + (* ; "Edited 29-Sep-2023 17:25 by rmk") (* ; "Edited 5-Apr-2023 10:12 by rmk") (* ; "Edited 29-Mar-2022 11:50 by rmk") (* ; "Edited 23-Feb-2022 21:10 by rmk") @@ -116,7 +117,11 @@ (PRINTOUT T "Fixing directory dates" T) (FIX-DIRECTORY-DATES DIR1) (FIX-DIRECTORY-DATES DIR2)) - (CDPRINT.HEADER DIR1 DIR2 SELECT DATE T) + (CDPRINT.HEADER (OR (CAR SHORTDIRNAMES) + DIR1) + (OR (CADR SHORTDIRNAMES) + DIR2) + SELECT DATE T) (PRINTOUT T " ... ") (SETQ INFOS1 (COMPAREDIRECTORIES.INFOS DIR1 INCLUDEDFILES EXCLUDEDFILES ALLVERSIONS DEPTH1 USEDIRECTORYDATE (MEMB 'AUTHOR SELECT))) @@ -2197,25 +2202,25 @@ (MOVD? 'NILL 'TEDIT.FILEDATE) (DECLARE%: DONTCOPY - (FILEMAP (NIL (2527 22645 (COMPAREDIRECTORIES 2537 . 7627) (COMPAREDIRECTORIES.INFOS 7629 . 10587) ( -COMPAREDIRECTORIES.CANDIDATES 10589 . 13974) (CDENTRIES.SELECT 13976 . 18751) ( -COMPAREDIRECTORIES.INFOS.TYPE 18753 . 19879) (MATCHNAME 19881 . 20561) (CD.INSURECDVALUE 20563 . 22177 -) (CD.UPDATEWIDTHS 22179 . 22643)) (22646 33268 (CDFILES 22656 . 28670) (CDFILES.MATCH 28672 . 30297) -(CDFILES.PATS 30299 . 33266)) (33269 51090 (CDPRINT 33279 . 35796) (CDPRINT.HEADER 35798 . 36695) ( -CDPRINT.LINE 36697 . 39929) (CDPRINT.MAXWIDTHS 39931 . 44046) (CDPRINT.COLHEADERS 44048 . 45333) ( -CDPRINT.COLUMNS 45335 . 50455) (CDTEDIT 50457 . 51088)) (51091 60212 (CDMAP 51101 . 52533) (CDENTRY -52535 . 52844) (CDSUBSET 52846 . 54285) (CDMERGE 54287 . 58271) (CDMERGE.COMMON 58273 . 59588) ( -CD.SORT 59590 . 60210)) (60213 67751 (BINCOMP 60223 . 64512) (EOLTYPE 64514 . 67076) (EOLTYPE.SHOW -67078 . 67749)) (68279 80806 (FIND-UNCOMPILED-FILES 68289 . 71932) (FIND-UNSOURCED-FILES 71934 . 74318 -) (FIND-SOURCE-FILES 74320 . 76058) (FIND-COMPILED-FILES 76060 . 77937) (FIND-UNLOADED-FILES 77939 . -78792) (FIND-LOADED-FILES 78794 . 79222) (FIND-MULTICOMPILED-FILES 79224 . 80804)) (80807 89238 ( -CREATED-AS 80817 . 85614) (SOURCE-FOR-COMPILED-P 85616 . 88543) (COMPILE-SOURCE-DATE-DIFF 88545 . -89236)) (89239 100002 (FIX-DIRECTORY-DATES 89249 . 92699) (FIX-EQUIV-DATES 92701 . 94226) ( -COPY-COMPARED-FILES 94228 . 96049) (COPY-MISSING-FILES 96051 . 98208) (COMPILED-ON-SAME-SOURCE 98210 - . 100000)) (100196 108034 (CDBROWSER 100206 . 104133) (CDBROWSER.STRINGS 104135 . 108032)) (108196 -109932 (CD.TABLEITEM 108206 . 108426) (CD.TABLEITEM.PRINTFN 108428 . 108627) (CD.TABLEITEM.COPYFN -108629 . 109687) (CDTABLEBROWSER.HEADING.REPAINTFN 109689 . 109930)) (109933 130588 ( -CDTABLEBROWSER.WHENSELECTEDFN 109943 . 110411) (CD.COMMANDSELECTEDFN 110413 . 115514) (CD-MENUFN -115516 . 119827) (CD-COMPARE-FILES 119829 . 123181) (CDBROWSER-COPY 123183 . 126852) ( -CDBROWSER-DELETE-FILE 126854 . 130067) (CD-SWAPDIRS 130069 . 130586))))) + (FILEMAP (NIL (2526 22889 (COMPAREDIRECTORIES 2536 . 7871) (COMPAREDIRECTORIES.INFOS 7873 . 10831) ( +COMPAREDIRECTORIES.CANDIDATES 10833 . 14218) (CDENTRIES.SELECT 14220 . 18995) ( +COMPAREDIRECTORIES.INFOS.TYPE 18997 . 20123) (MATCHNAME 20125 . 20805) (CD.INSURECDVALUE 20807 . 22421 +) (CD.UPDATEWIDTHS 22423 . 22887)) (22890 33512 (CDFILES 22900 . 28914) (CDFILES.MATCH 28916 . 30541) +(CDFILES.PATS 30543 . 33510)) (33513 51334 (CDPRINT 33523 . 36040) (CDPRINT.HEADER 36042 . 36939) ( +CDPRINT.LINE 36941 . 40173) (CDPRINT.MAXWIDTHS 40175 . 44290) (CDPRINT.COLHEADERS 44292 . 45577) ( +CDPRINT.COLUMNS 45579 . 50699) (CDTEDIT 50701 . 51332)) (51335 60456 (CDMAP 51345 . 52777) (CDENTRY +52779 . 53088) (CDSUBSET 53090 . 54529) (CDMERGE 54531 . 58515) (CDMERGE.COMMON 58517 . 59832) ( +CD.SORT 59834 . 60454)) (60457 67995 (BINCOMP 60467 . 64756) (EOLTYPE 64758 . 67320) (EOLTYPE.SHOW +67322 . 67993)) (68523 81050 (FIND-UNCOMPILED-FILES 68533 . 72176) (FIND-UNSOURCED-FILES 72178 . 74562 +) (FIND-SOURCE-FILES 74564 . 76302) (FIND-COMPILED-FILES 76304 . 78181) (FIND-UNLOADED-FILES 78183 . +79036) (FIND-LOADED-FILES 79038 . 79466) (FIND-MULTICOMPILED-FILES 79468 . 81048)) (81051 89482 ( +CREATED-AS 81061 . 85858) (SOURCE-FOR-COMPILED-P 85860 . 88787) (COMPILE-SOURCE-DATE-DIFF 88789 . +89480)) (89483 100246 (FIX-DIRECTORY-DATES 89493 . 92943) (FIX-EQUIV-DATES 92945 . 94470) ( +COPY-COMPARED-FILES 94472 . 96293) (COPY-MISSING-FILES 96295 . 98452) (COMPILED-ON-SAME-SOURCE 98454 + . 100244)) (100440 108278 (CDBROWSER 100450 . 104377) (CDBROWSER.STRINGS 104379 . 108276)) (108440 +110176 (CD.TABLEITEM 108450 . 108670) (CD.TABLEITEM.PRINTFN 108672 . 108871) (CD.TABLEITEM.COPYFN +108873 . 109931) (CDTABLEBROWSER.HEADING.REPAINTFN 109933 . 110174)) (110177 130832 ( +CDTABLEBROWSER.WHENSELECTEDFN 110187 . 110655) (CD.COMMANDSELECTEDFN 110657 . 115758) (CD-MENUFN +115760 . 120071) (CD-COMPARE-FILES 120073 . 123425) (CDBROWSER-COPY 123427 . 127096) ( +CDBROWSER-DELETE-FILE 127098 . 130311) (CD-SWAPDIRS 130313 . 130830))))) STOP diff --git a/lispusers/COMPAREDIRECTORIES.LCOM b/lispusers/COMPAREDIRECTORIES.LCOM index 331f7dde6e8e2f5f8d8876c490c7c411966c3371..11d21d730f552a18090fde386f197644d9d30fdd 100644 GIT binary patch delta 463 zcmZutOG^S_6m7;V8Y9Xi%GG5cNJRUdaawZ+{#W?0B0znrNNSKSFUB4jvHny{$ z&}$#HY|*A4)MrMtaCHv%-gEA`_xVlzd{b|l3BZ|h>oP+SVSt&h(TWgZPYWa6pLMDQ+z3D#ky7dD;Cs?)gW~JpyHH0 z(No7!E2hk8PwSDkvRsHOFOmI1T$La$=08ph1M+Sy@GBv314G#>9{^`a7PF1o#J%ae zVX+RJm=Jn_oRk#9M1g@L>yJ?=d6hy~1ZHul%LKqoF7Bi2YR(c5T0-(;M`=opT+iNuC}T HukXGAO^bCP delta 515 zcmZutPiq=M6z^&@n4C%_(58pS79k#X*_oZ$akn|dx?^3~b!B#}%`u<{X$hhp0;LFE zd#TJNr9JdJq#vLp#}FhRpkF0)v`yNBw;#Xv-tW&_UgmyW=05kz*t3$8v4tH>0Hc85 zfUw28m(QqQg&h++|E6d?rD*YUZ`O?7T45x3L#E=`3hR<*Fgyjb*^OiP|H!s&6Z$99 zL4UIvGpjoX%_!y#!L>>V=B7Xe(eEah: select entries where file1 has a later date than file2 BEFORE or <: select entries where file1 has an earlier date than file2 SAMEDATE or =: select entries where file1 and file2 have the same date -*: exclude entries where file1 does not exist *-: exclude entries where file2 does not exist ~=: exclude entries where file1 and file2 are byte-equivalent SELECT = NIL is equivalent to (< > -* *-). Excludes files with matching dates, a useful default for identifying files that may require further attention. SELECT = T is equivalent to (= < > -* *-). Includes all files for processing by other functions or later filtering by CDSUBSET (below). SELECT may also contain the token AUTHOR to indicate that authors should be provided in the printed output (see CDPRINT below). Unless USEDIRECTORYDATES, the FILECREATED date is used for the date comparison of Lisp source and compiled files, otherwise the file-system CREATIONDATE is used. If OUTPUTFILE=NIL, then a list of the form (Parameters . entries) is returned. Parameters is a list (DIR1 DIR2 SELECT DATE) that records the parameters of the comparison. Entries contains one entry for each of the file-comparisons that meets the SELECT criteria. Each entry is a CDENTRY record with fields (matchname info1 daterel info2 equiv) where matchname is the name.extension shared by the two files, and each file info is either NIL (for nonexistent files) or a CDINFO record with fields (FULLNAME DATE LENGTH AUTHOR TYPE EOL) TYPE is SOURCE for Lisp source (filecreated) files, COMPILED for Lisp compiled files, otherwise the PRINTFILETYPE (TEXT, TEDIT...) or NIL. EOL is CR, LF, CRLF, or NIL. When both files exist, the date relation is one of <, =, or >. Otherwise, the date relation is * if only one file exists. EQUIV is EQUIVALENT for files with different dates but exactly the same bytes, otherwise NIL. If OUTPUTFILE is not NIL, then it is a filename or open stream on which selected entries will be printed (T for the terminal) by CDPRINT. COMPAREDIRECTORIES sets the variable LASTCDENTRIES is set to the selected entries. This is used by the functions below if their CDENTRIES is NIL. (CDFILES DIR FILEPATTERNS EXTENSIONSTOAVOID ALLVERSIONS DEPTH) [Function] Returns a list of full filenames for files in directory DIR (NIL=T=the connected directory) that match the other file-name filtering criteria. Files are excluded if: Their name does not match a pattern in FILEPATTERNS (NIL = *). Dotted files are excluded unless FILEPATTERNS includes .* and files in subdirectories are excluded if the number of subdirectories exceeds DEPTH (below). Their extension is in the list EXTENSIONSTOAVOID (* excludes all extensions). They are not the highest version unless ALLVERSIONS=T. DEPTH controls the depth of subdirectory exploration. T means all levels, NIL means no subdirectories. Otherwise the maximum number of ">" characters below the starting DIR in the fullname of files. (CDFILES) produces all the newest, undotted files in the immediate connected directory. (CDPRINT CDENTRIES FILE PRINTAUTHOR) [Function] Prints CDENTRIES on FILE, with one line for each entry. The line for each entry is of the form FILE1 (AUTHOR) SIZE DATE relation DATE FILE2 (AUTHOR) SIZE For example ACE.;1 (Joe) 4035 2-May-1985 18:03:54 < 30-Sep-1985 11:14:48 ACE.;3 (Sam) 5096. The line for byte-equivalent files is prefixed with ==. If the files are equivalent except for a difference in end-of-line conventions, the equivalence prefix will indicate the convention for each file (C for CR, L, for LF, 2 for CRLF). Thus C2 indicates that the files are equivalent except that file1 marks line ends with CR and file2 with CRLF. Note that because of the setting of LASTCDENTRIES, evaluating (CDPRINT) after COMPAREDIRECTORIES prints the results of the last comparision. For conciseness, authors are included only if PRINTAUTHOR or if AUTHOR is included in the SELECT parameter of CDENTRIES. Also, the redundant file-name hosts/directories are not printed. (CDMAP CDENTRIES FN) [Function] (CDSUBSET CDENTRIES FN) [Function] CDMAP applies FN to each CDENTRY in CDENTRIES. CDSUBSET applies FN and also returns the subset of CDENTRIES for which FN is non-NIL and preserves in the value the parameters of CDENTRIES. For convenience, at each invocation the variables MATCHNAME INFO1 DATEREL INFO2 and EQUIV are bound to the corresponding fields and can be used freely by FN. USEFUL UTILITIES (FIX-DIRECTORY-DATES FILES) [Function] For every file included in or specified by FILES, if it is a Lisp source or compiled whose directory creation date is more than 30 seconds later than its internal filecreated date (presumably because of copying), then its directory date is reset to match the internal date. FILES can be a list of file names or a pattern interpretable by FILDIR. Returns a list of files whose dates have been changed. (FIX-EQUIV-DATES CDENTRIES) [Function] If there is an entry in CDENTRIES whose files are EQUIVALENT but with different directory creation dates, the directory date of the file with the later date (presumably a copy) is reset to match the date of the earlier file. In the end all equivalent files will have the same (earliest) date. Returns a list of files whose dates have been changed. (COPY-MISSING-FILES CDENTRIES TARGET MATCHNAMES) [Function] Target is 1 or 2, indicating the direction of potential copies. If an entry with a source file but no target file has a matchname in MATCHNAMES, the source file is copied to the target directory. All target-absent files are copied if MATCNAMES is NIL. Source properties (including version number) are preserved in the target. (COPY-COMPARED-FILES CDENTRIES TARGET MATCHNAMES) [Function] Target is 1 or 2, indicating the direction of potential copies. If an entry with both source and target files has a matchname in MATCHNAMES, the source file is copied to a new version of the target file. All files are copied if MATCHNAMES is NIL. (COMPARE-ENTRY-SOURCE-FILES CDENTRY LISTSTREAM EXAMINE DW?) [Function] This is a simple wrapper for calling COMPARESOURCES if the CDENTRY files are Lisp source files. The function (CDENTRY MATCHNAME CDENTRIES is useful for extracting a particular entry, with CDENTRIES defaulting to LASTCDENTRIES. (COMPILED-ON-SAME-SOURCE CDENTRIES) [Function] Returns the subset of entries with Lisp compiled files (dfasl or lcom) that are compiled on the same source, according to SOURCE-FOR-COMPILED-P below. Presumably one should be removed to avoid confusion. (FIND-SOURCE-FILES CFILES SDIRS DFASLMARGIN) [Function] Returns (CFILE . SFILES) pairs where CFILE is a Lisp compiled file in CFILES and SFILES is list of files in SDIRS that CFILE was compiled on according to SOURCE-FOR-COMPILED-P. This suggests that at least one of SFILES should be copied to CFILE's location (or vice versa). (FIND-COMPILED-FILES SFILES CDIRS DFASLMARGIN) [Function] Returns (SFILE . CFILES) pairs where SFILE is a Lisp source file in SFILES and CFILES are files in CDIRS that are compiled on SFILE according to SOURCE-FOR-COMPILED-P. This suggests that at least one of CFILES should be copied to SFILE's location. (FIND-UNCOMPILED-FILES FILES DFASLMARGIN COMPILEXTS) [Function] Returns a list of elements each of which corresponds to a source file in FILES for which no appropriate compiled file can be found. An appropriate compiled file is a file in the same location with extension in COMPILEEXTS (defaulting to *COMPILED-EXTENSIONS*) that satisfies SOURCE-FOR-COMPILED-P. Each element is a list of the form (sourcefile . cfiles) cfiles contains compiled files that were compiled on a different version of sourcefile, NIL if no such files exist. Each cfile item is a pair (cfile timediff) where timediff is the time difference (in minutes) between the creation date of the compiled-file's source and the creation date of sourcefile (positive if the cfile was compiled later, as should be the case). FILES can be an explicit list of files, or a file specification interpretable by FILDIR; in that case only the newest source-file versions are processed. (FIND-UNSOURCED-FILES CFILES DFASLMARGIN COMPILEXTS) [Function] Returns the subset of the compiled files specified by CFILES for which a corresponding source file according to SOURCE-FOR-COMPILED-P cannot be found in the same directory. CFILES can be a list of files or a pattern that FILDIR can interpret. COMPILEEXTS can be one or more explicit compile-file extensions, defaulting to *COMPILED-EXTENSIONS*. (SOURCE-FOR-COMPILED-P SOURCE COMPILED DFASLMARGIN) [Function] Returns T if it can confirm that Lisp COMPILED file was compiled on Lisp SOURCE file. SOURCE and COMPILED can be provided as CREATED-AS values, to avoid repetitive computation. This compares the information in the filecreated expressions, original file names and original dates, and not the current directory names and dates. It appears that the times in DFASL files may differ from the filecreated source dates by a few minutes. The DFASLMARGIN can be provided to loosen up the date matching criterion. DFASLMARGIN is a pair (max min) and a DFASL COMPILED is deemed to be compiled on SOURCE if the compiled's source date is no more than max and no less than min minutes after the source date. A negative min allows for the possibility that the compiled-source date is earlier than the candidate source date. DFASLMARGIN defaults to (20 0). A single positive number x is coerced to (x 0). A single negative number is coerced to (-x x) (compiled file is no more than x minutes later or earlier). T is infinity in either direction. Examples: (T 0): COMPILED compiled on source later than SOURCE (0 T): COMPILED compiled on source earlier than SOURCE (odd) 12: COMPILED compiled on source later than SOURCE by no more than 12 minutes -12: COMPILED compiled on source 12 minutes before or after SOURCE (FIND-MULTICOMPILED-FILES FILES SHOWINFO) [Function] Returns a list of files in FILES that have more than one type of compiled file (e.g. LCOM and DFASL). FILES is interpretable by FILDIR. If SHOWINFO, then the value contains a list for each file of the form - (rootname loaded-version . CREATED-AS information for each compile-type) Otherwise just the rootname of the source is returns. (CREATED-AS FILE) [Function] If FILE is a Lisp source or compiled file, returns a record of its original filename and filecreated dates, and for compiled files, also the original compiled-on name and date. The return for a source file is a pair (sfullname sfilecreateddate) The return for a compiled file is a quadruple (cfullname cfilecreated sfullname sfilecreateddate) where sfullname and sourcefilecreated are extracted from the file's compiled-on information. The return is (fullname NIL) for a non-Lisp file. (EOLTYPE FILE SHOWCONTEXT) [Function] Returns the EOLTYPE of FILE (CR, LF, CRLF) if the type is unmistakable: contains at least one instance of one type and no instances of any others. Returns NIL if there is evidence of inconsistent types. If SHOWCONTEXT is an integer, it is the number of bytes for EOLTYPE to display before and after an instance of an inconsistent type. At each instance, the user is asked whether to continue scanning for other instances. SHOWCONTEXT = T is interpreted as 100. (BINCOMP FILE1 FILE2 EOLDIFFOK) [Function] Returns T if FILE1 and FILE2 are byte-identical. If EOLDIFFOK and FILE1 and FILE2 differ only in their eol conventions, the value is a list of the form (EOL1 EOL2), e.g. (CR CRLF). Otherwise the value is NIL. (LIST ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC) STARTINGPAGE# 1) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC)) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC)) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC)) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC)) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC)) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))))) 1$4@$È4È$È4È$È40È$È1$4 È$È1È$1ŠŠ8$1ŠŠ8$JÈ$È PAGEHEADING RUNNINGHEAD +XEROX COMPAREDIRECTORIES +2 + +4 + +1 + +COMPAREDIRECTORIES +1 + +4 + +By: Larry Masinter and Ron Kaplan +This document edited on + December 2, 1987 + December 28, 1998 (Ron Kaplan) + April 7, 2018 (Ron Kaplan) + Rewritten August 25, 2020 (Ron Kaplan) + +COMPAREDIRECTORIES compares the contents of two directories, identifying files according to their creation dates and lengths. It is called using the function +(COMPAREDIRECTORIES DIR1 DIR2 SELECT FILEPATTERNS EXTENSIONSTOAVOID USEDIRECTORYDATES OUTPUTFILE ALLVERSIONS SHORTDIRNAMES) [Function] +Compares the creation dates of files with matching names in the lists that CDFILES returns for DIR1 and DIR2. Collects or prints CDENTRIES for those files that meet the SELECT criteria. May also collect or print entries for relevant files that exist in DIR1 or DIR2 but not both. +SELECT specifies which the match/mismatch criteria for filtering the output. If SELECT is or contains + AFTER or >: select entries where file1 has a later date than file2 + BEFORE or <: select entries where file1 has an earlier date than file2 + SAMEDATE or =: select entries where file1 and file2 have the same date + -*: exclude entries where file1 does not exist + *-: exclude entries where file2 does not exist + ~=: exclude entries where file1 and file2 are byte-equivalent +SELECT = NIL is equivalent to (< > -* *-). Excludes files with matching dates, a useful default for identifying files that may require further attention. +SELECT = T is equivalent to (= < > -* *-). Includes all files for processing by other functions or later filtering by CDSUBSET (below). +SELECT may also contain the token AUTHOR to indicate that authors should be provided in the printed output (see CDPRINT below). +Unless USEDIRECTORYDATES, the FILECREATED date is used for the date comparison of Lisp source and compiled files, otherwise the file-system CREATIONDATE is used. +If OUTPUTFILE=NIL, then a list of the form (Parameters . entries) is returned. Parameters is a list (DIR1 DIR2 SELECT DATE) that records the parameters of the comparison. Entries contains one entry for each of the file-comparisons that meets the SELECT criteria. Each entry is a CDENTRY record with fields + (matchname info1 daterel info2 equiv) +where matchname is the name.extension shared by the two files, and each file info is either NIL (for nonexistent files) or a CDINFO record with fields + (FULLNAME DATE LENGTH AUTHOR TYPE EOL) +TYPE is SOURCE for Lisp source (filecreated) files, COMPILED for Lisp compiled files, otherwise the PRINTFILETYPE (TEXT, TEDIT...) or NIL. EOL is CR, LF, CRLF, or NIL. +When both files exist, the date relation is one of <, =, or >. Otherwise, the date relation is * if only one file exists. EQUIV is EQUIVALENT for files with different dates but exactly the same bytes, otherwise NIL. +If OUTPUTFILE is not NIL, then it is a filename or open stream on which selected entries will be printed (T for the terminal) by CDPRINT. +SHORTDIRNAMES can be a pair of strings to be used instead of the full directory names when header information is printed. +COMPAREDIRECTORIES sets the variable LASTCDENTRIES is set to the selected entries. This is used by the functions below if their CDENTRIES is NIL. + +(CDFILES DIR FILEPATTERNS EXTENSIONSTOAVOID ALLVERSIONS DEPTH) [Function] +Returns a list of full filenames for files in directory DIR (NIL=T=the connected directory) that match the other file-name filtering criteria. Files are excluded if: +Their name does not match a pattern in FILEPATTERNS (NIL = *). Dotted files are excluded unless FILEPATTERNS includes .* and files in subdirectories are excluded if the number of subdirectories exceeds DEPTH (below). +Their extension is in the list EXTENSIONSTOAVOID (* excludes all extensions). +They are not the highest version unless ALLVERSIONS=T. +DEPTH controls the depth of subdirectory exploration. T means all levels, NIL means no subdirectories. Otherwise the maximum number of ">" characters below the starting DIR in the fullname of files. +(CDFILES) produces all the newest, undotted files in the immediate connected directory. + +(CDPRINT CDENTRIES FILE PRINTAUTHOR) [Function] +Prints CDENTRIES on FILE, with one line for each entry. The line for each entry is of the form + FILE1 (AUTHOR) SIZE DATE relation DATE FILE2 (AUTHOR) SIZE +For example + ACE.;1 (Joe) 4035 2-May-1985 18:03:54 < 30-Sep-1985 11:14:48 ACE.;3 (Sam) 5096. +The line for byte-equivalent files is prefixed with ==. If the files are equivalent except for a difference in end-of-line conventions, the equivalence prefix will indicate the convention for each file (C for CR, L, for LF, 2 for CRLF). Thus C2 indicates that the files are equivalent except that file1 marks line ends with CR and file2 with CRLF. +Note that because of the setting of LASTCDENTRIES, evaluating (CDPRINT) after COMPAREDIRECTORIES prints the results of the last comparision. +For conciseness, authors are included only if PRINTAUTHOR or if AUTHOR is included in the SELECT parameter of CDENTRIES. Also, the redundant file-name hosts/directories are not printed. + +(CDMAP CDENTRIES FN) [Function] +(CDSUBSET CDENTRIES FN) [Function] +CDMAP applies FN to each CDENTRY in CDENTRIES. CDSUBSET applies FN and also returns the subset of CDENTRIES for which FN is non-NIL and preserves in the value the parameters of CDENTRIES. For convenience, at each invocation the variables MATCHNAME INFO1 DATEREL INFO2 and EQUIV are bound to the corresponding fields and can be used freely by FN. + +USEFUL UTILITIES +(FIX-DIRECTORY-DATES FILES) [Function] +For every file included in or specified by FILES, if it is a Lisp source or compiled whose directory creation date is more than 30 seconds later than its internal filecreated date (presumably because of copying), then its directory date is reset to match the internal date. FILES can be a list of file names or a pattern interpretable by FILDIR. Returns a list of files whose dates have been changed. + +(FIX-EQUIV-DATES CDENTRIES) [Function] +If there is an entry in CDENTRIES whose files are EQUIVALENT but with different directory creation dates, the directory date of the file with the later date (presumably a copy) is reset to match the date of the earlier file. In the end all equivalent files will have the same (earliest) date. Returns a list of files whose dates have been changed. + +(COPY-MISSING-FILES CDENTRIES TARGET MATCHNAMES) [Function] +Target is 1 or 2, indicating the direction of potential copies. If an entry with a source file but no target file has a matchname in MATCHNAMES, the source file is copied to the target directory. All target-absent files are copied if MATCNAMES is NIL. Source properties (including version number) are preserved in the target. + +(COPY-COMPARED-FILES CDENTRIES TARGET MATCHNAMES) [Function] +Target is 1 or 2, indicating the direction of potential copies. If an entry with both source and target files has a matchname in MATCHNAMES, the source file is copied to a new version of the target file. All files are copied if MATCHNAMES is NIL. + +(COMPARE-ENTRY-SOURCE-FILES CDENTRY LISTSTREAM EXAMINE DW?) + [Function] +This is a simple wrapper for calling COMPARESOURCES if the CDENTRY files are Lisp source files. The function (CDENTRY MATCHNAME CDENTRIES is useful for extracting a particular entry, with CDENTRIES defaulting to LASTCDENTRIES. + +(COMPILED-ON-SAME-SOURCE CDENTRIES) [Function] +Returns the subset of entries with Lisp compiled files (dfasl or lcom) that are compiled on the same source, according to SOURCE-FOR-COMPILED-P below. Presumably one should be removed to avoid confusion. + +(FIND-SOURCE-FILES CFILES SDIRS DFASLMARGIN) [Function] +Returns (CFILE . SFILES) pairs where CFILE is a Lisp compiled file in CFILES and SFILES is list of files in SDIRS that CFILE was compiled on according to SOURCE-FOR-COMPILED-P. This suggests that at least one of SFILES should be copied to CFILE's location (or vice versa). + +(FIND-COMPILED-FILES SFILES CDIRS DFASLMARGIN) [Function] +Returns (SFILE . CFILES) pairs where SFILE is a Lisp source file in SFILES and CFILES are files in CDIRS that are compiled on SFILE according to SOURCE-FOR-COMPILED-P. This suggests that at least one of CFILES should be copied to SFILE's location. + +(FIND-UNCOMPILED-FILES FILES DFASLMARGIN COMPILEXTS) [Function] +Returns a list of elements each of which corresponds to a source file in FILES for which no appropriate compiled file can be found. An appropriate compiled file is a file in the same location with extension in COMPILEEXTS (defaulting to *COMPILED-EXTENSIONS*) that satisfies SOURCE-FOR-COMPILED-P. Each element is a list of the form + (sourcefile . cfiles) +cfiles contains compiled files that were compiled on a different version of sourcefile, NIL if no such files exist. Each cfile item is a pair (cfile timediff) where timediff is the time difference (in minutes) between the creation date of the compiled-file's source and the creation date of sourcefile (positive if the cfile was compiled later, as should be the case). FILES can be an explicit list of files, or a file specification interpretable by FILDIR; in that case only the newest source-file versions are processed. + +(FIND-UNSOURCED-FILES CFILES DFASLMARGIN COMPILEXTS) [Function] +Returns the subset of the compiled files specified by CFILES for which a corresponding source file according to SOURCE-FOR-COMPILED-P cannot be found in the same directory. CFILES can be a list of files or a pattern that FILDIR can interpret. COMPILEEXTS can be one or more explicit compile-file extensions, defaulting to *COMPILED-EXTENSIONS*. + +(SOURCE-FOR-COMPILED-P SOURCE COMPILED DFASLMARGIN) [Function] +Returns T if it can confirm that Lisp COMPILED file was compiled on Lisp SOURCE file. SOURCE and COMPILED can be provided as CREATED-AS values, to avoid repetitive computation. This compares the information in the filecreated expressions, original file names and original dates, and not the current directory names and dates. +It appears that the times in DFASL files may differ from the filecreated source dates by a few minutes. The DFASLMARGIN can be provided to loosen up the date matching criterion. DFASLMARGIN is a pair (max min) and a DFASL COMPILED is deemed to be compiled on SOURCE if the compiled's source date is no more than max and no less than min minutes after the source date. A negative min allows for the possibility that the compiled-source date is earlier than the candidate source date. DFASLMARGIN defaults to (20 0). A single positive number x is coerced to (x 0). A single negative number is coerced to (-x x) (compiled file is no more than x minutes later or earlier). T is infinity in either direction. Examples: + (T 0): COMPILED compiled on source later than SOURCE + (0 T): COMPILED compiled on source earlier than SOURCE (odd) + 12: COMPILED compiled on source later than SOURCE by no more than 12 minutes + -12: COMPILED compiled on source 12 minutes before or after SOURCE + +(FIND-MULTICOMPILED-FILES FILES SHOWINFO) [Function] +Returns a list of files in FILES that have more than one type of compiled file (e.g. LCOM and DFASL). FILES is interpretable by FILDIR. If SHOWINFO, then the value contains a list for each file of the form + (rootname loaded-version . CREATED-AS information for each compile-type) + Otherwise just the rootname of the source is returns. + +(CREATED-AS FILE) [Function] +If FILE is a Lisp source or compiled file, returns a record of its original filename and filecreated dates, and for compiled files, also the original compiled-on name and date. The return for a source file is a pair + (sfullname sfilecreateddate) +The return for a compiled file is a quadruple + (cfullname cfilecreated sfullname sfilecreateddate) +where sfullname and sourcefilecreated are extracted from the file's compiled-on information. The return is (fullname NIL) for a non-Lisp file. + +(EOLTYPE FILE SHOWCONTEXT) [Function] +Returns the EOLTYPE of FILE (CR, LF, CRLF) if the type is unmistakable: contains at least one instance of one type and no instances of any others. Returns NIL if there is evidence of inconsistent types. If SHOWCONTEXT is an integer, it is the number of bytes for EOLTYPE to display before and after an instance of an inconsistent type. At each instance, the user is asked whether to continue scanning for other instances. SHOWCONTEXT = T is interpreted as 100. + +(BINCOMP FILE1 FILE2 EOLDIFFOK) [Function] +Returns T if FILE1 and FILE2 are byte-identical. If EOLDIFFOK and FILE1 and FILE2 differ only in their eol conventions, the value is a list of the form (EOL1 EOL2), e.g. (CR CRLF). Otherwise the value is NIL. + + + + + + + +(LIST ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC) STARTINGPAGE# 1) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC)) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC)) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC)) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC)) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC)) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))))) 1$4@$È4È$È4È$È40È$È1$4 È$È1È$1ŠŠ8$1ŠŠ8$JÈ$È PAGEHEADING RUNNINGHEAD MODERN rd(DEFAULTFONT 1 (TERMINAL 12) (TERMINAL 8) (TERMINAL 8) (PDF (TERMINAL 8)) (POSTSCRIPT (TERMINAL 8))) TERMINAL GACHA @@ -13,4 +137,4 @@ XEROX COMPAREDIRECTORIES 2 MODERN MODERNLOGO     HRULE.GETFN  HRULE.GETFN  HRULE.GETFN  - HRULE.GETFN  HRULE.GETFN#!(ž[fJLL44C›Š€£6)˜*©Ú‹”K¦ÙN7ÉX1_A P]Ž» #Z/“']<I=û< ä/Ì8:û@O@[?HÑ:BRJ5ÐN7Ù".9&Ñ+ÕDATE:g9^^1.zº \ No newline at end of file + HRULE.GETFN  HRULE.GETFN#!(ž[  fJLL44C›Š€£6)˜*©Ú‹y”K¦ÙN7ÉX1_A P]Ž» #Z/“']<I=û< ä/Ì8:û@O@[?HÑ:BRJ5ÐN7Ù".9&Ñ+ÕDATE:güb1¶ zº \ No newline at end of file