(DEFINE-FILE-INFO READTABLE "INTERLISP" PACKAGE "INTERLISP" BASE 10) (FILECREATED "27-Oct-89 15:35:24" {ICE}LISPUSERS>MEDLEY>WALKFILES.;1 3051 changes to%: (VARS WALKFILESCOMS) previous date%: "13-Oct-89 16:26:34" {ICE}LISPUSERS>KOTO>WALKFILES.;2) (* " Copyright (c) 1989 by Johannes A. G. M. Koomen. All rights reserved. ") (PRETTYCOMPRINT WALKFILESCOMS) (RPAQQ WALKFILESCOMS ((FNS WALKDEFS WALKFILES) (PROP MAKEFILE-ENVIRONMENT (QUOTE WALKFILES)))) (DEFINEQ (WALKDEFS (LAMBDA (PATTERN NAMES TYPE EDITCOMMANDS CONFIRMFLG QUIETFLG RETFROMFN) (* Koomen "13-Oct-89 16:23") (* ;; "Searches the defs of each name on NAMES for PATTERN. When found, invokes editor on the object with EDITCOMMANDS. If CONFIRMFLG, prompts for confirmation first before invoking editor. If not QUIETFLG, provides feedback. If EDITCOMMANDS = NIL, uses `((LP (F ,PATTERN N) P)), i.e. prints each occurrance in the def. If EDITCOMMANDS = T, uses `((EXAM ,PATTERN)), i.e. let editor walk through each occurrance.") (for NAME inside NAMES bind EDITFPAT EDITCOMS PRETTYTYPE CONFIRMED DONE first (SETQ EDITFPAT (EDITFPAT (if (AND (LITATOM PATTERN) (NULL EDITCOMMANDS)) then (BQUOTE (-- (\, PATTERN) --)) else PATTERN))) (SETQ EDITCOMS (if (NULL EDITCOMMANDS) then (BQUOTE ((LP (F (\, EDITFPAT) N) P))) elseif (EQ EDITCOMMANDS T) then (BQUOTE ((EXAM (\, EDITFPAT)))) else EDITCOMMANDS)) (SETQ PRETTYTYPE QUIETFLG) (SETQ CONFIRMED (OR (NULL CONFIRMFLG) (NULL EDITCOMMANDS) (NEQ EDITCOMMANDS T))) when (if (NOT (FMEMB NAME DONE)) then (push DONE NAME) (if (OR (HASDEF NAME TYPE (QUOTE CURRENT)) (HASDEF NAME TYPE (QUOTE SAVED))) then (EDITFINDP (GETDEF NAME TYPE NIL (QUOTE DONTCOPY)) EDITFPAT T))) do (if (NOT PRETTYTYPE) then (SETQ PRETTYTYPE (OR (CADDR (SEARCHPRETTYTYPELST TYPE)) (L-CASE TYPE T))) (PRINTOUT NIL PRETTYTYPE ":" T)) (if (NOT QUIETFLG) then (PRINTOUT NIL "--> " NAME T)) (if (ARGTYPE EDITCOMS) then (APPLY* EDITCOMS NAME TYPE) elseif (OR CONFIRMED (MOUSECONFIRM "Edit? ")) then (EDITDEF NAME TYPE NIL EDITCOMS) elseif (NOT (MOUSECONFIRM "Continue?")) then (RETFROM (OR RETFROMFN (QUOTE WALKDEFS)))))) ) (WALKFILES (LAMBDA (PATTERN FILES EDITCOMMANDS CONFIRMFLG QUIETFLG FILEPACKAGETYPES) (* Koomen "13-Oct-89 16:24") (* ;; "If EDITCOMS=NIL, use `((LP (F ,PATTERN N) P))") (* ;; "If EDITCOMS=T, use `((EXAM ,PATTERN))") (* ;; "If EDITCOMS=atomic, APPLY it to appropriate objects") (* ;; "If FILES=NIL, use FILELST") (* ;; "If FILEPACKAGETYPES=NIL, use atomic entries on FILEPKGTYPES") (DECLARE (GLOBALVARS FILELST FILEPKGTYPES)) (for FILE inside (OR FILES FILELST) bind (TYPES _ (OR FILEPACKAGETYPES (for TYPE in FILEPKGTYPES when (SEARCHPRETTYTYPELST TYPE) collect TYPE))) do (if (NOT QUIETFLG) then (printout T "---- Searching file " FILE T)) (for TYPE in TYPES bind NAMES when (SETQ NAMES (FILECOMSLST FILE TYPE)) do (BLOCK) (WALKDEFS PATTERN NAMES TYPE EDITCOMMANDS CONFIRMFLG QUIETFLG (FUNCTION WALKFILES))))) ) ) (PUTPROPS WALKFILES COPYRIGHT ("Johannes A. G. M. Koomen" 1989)) (DECLARE%: DONTCOPY (FILEMAP (NIL (499 2963 (WALKDEFS 509 . 2143) (WALKFILES 2145 . 2961))))) STOP