(FILECREATED "13-DEC-82 11:40:53" {PHYLUM}<LISPCORE>SOURCES>RENAMEFNS.;7 12703Q 

      changes to:  (FNS RNSUBST)

      previous date: "13-DEC-82 10:49:27" {PHYLUM}<LISPCORE>SOURCES>RENAMEFNS.;6)


(* Copyright (c) 1982 by Xerox Corporation)

(PRETTYCOMPRINT RENAMEFNSCOMS)

(RPAQQ RENAMEFNSCOMS [(FNS DORENAME DORENAME0 RENAMEFN RENAMEDVAL MAKECOMP RNSUBST)
		      (FILES (SOURCE)
			     FILESETS)
		      (BLOCKS (RNSUBST RNSUBST (NOLINKFNS . T])
(DEFINEQ

(DORENAME
  [LAMBDA (TYPE NOLOADFLG)                                   (* lmm " 5-APR-82 13:03")
    (DORENAME0 (SETQ RENAMETYPE TYPE)
	       NOLOADFLG)
    (for X in RENAMEFNSPAIRS do (RENAMEFN (CAR X)
					  (CDR X)))
    (MAKECOMP RENAMEDFILE (APPEND (RENAMEDVAL NEWCOMS)
				  EXTRACOMS])

(DORENAME0
  [LAMBDA (TYPE NOLOAD)                                      (* rrb "13-DEC-82 10:43")
    (PROG (LISPXHIST)
          (DECLARE (SPECVARS . T))
          [MAPC (CDR (ASSOC (OR TYPE (QUOTE I))
			    RENAMETYPES))
		(FUNCTION (LAMBDA (X)
		    (SETATOMVAL (CAR X)
				(CDR X]
          (RESETVARS ((LOADDBFLG (QUOTE NO))
		      (NOSPELLFLG T)
		      (CROSSCOMPILING T))
		     (FILESLOAD (SYSLOAD)
				DTDECLARE)
		     (for X in FILES do (PRINT (LOADFROM X)
					       T T)))
          [SETQ ALLFNS (INFILECOMS? NIL (QUOTE FNS)
				    (SETQ NEWCOMS (GETATOMVAL COMSNAME]
          [RESETVARS ((NOSPELLFLG T))
		     (MAPC FILES (FUNCTION (LAMBDA (FILE)
			       (LOADFNS ALLFNS FILE (QUOTE PROP]
          [SETQ NEWCOMS (MAPCAR NEWCOMS (FUNCTION (LAMBDA (X)
				    (COND
				      [(EQ (CADR X)
					   (QUOTE *))
					(CONS (CAR X)
					      (EVAL (CADDR X]
				      (T X]
          [SETQ RENAMEFNSPAIRS (MAPCAR (INFILECOMS? NIL (QUOTE FNS)
						    NEWCOMS)
				       (FUNCTION (LAMBDA (FN)
					   (CONS FN (PACK* PREFIX FN]
          (SETATOMVAL SUBNAME
		      (UNION [APPEND RENAMEFNSPAIRS
				     [MAPCONC (APPEND (GETATOMVAL VALUES)
						      (GETATOMVAL PTRS))
					      (FUNCTION (LAMBDA (X)
						  (AND (NEQ (CAR X)
							    (QUOTE *))
						       (LIST (CONS (CAR X)
								   (PACK* PREFIX (SUBSTRING
									    (CAR X)
									    2 -1]
				     [for X in INITCONSTANTS when (AND (NEQ (CAR X)
									    (QUOTE *))
								       (LISTP (CADR X)))
					collect (CONS (CAR X)
						      (LIST VAG2FN (CAADR X)
							    (CADR (CADR X]
				     (for X in FILES join (for Y in (FILECOMSLST X (QUOTE CONSTANTS))
							     collect (CONS Y (EVAL Y]
			     (GETATOMVAL SUBNAME])

(RENAMEFN
  [LAMBDA (OFN NFN)                                          (* lmm "21-AUG-81 08:16")
    (SETQ RENAMEALIST (EVALV SUBNAME))
    (until [ERSETQ (RESETVARS ((NOSPELLFLG T)
			       (DWIMESSGAG T)
			       (DWIMFLG)
			       (DWIMUSERFORMS))
			      (/PUTD NFN (RNSUBST (OR (AND (EXPRP OFN)
							   (GETD OFN))
						      (GETDEF OFN)
						      (HELP OFN (QUOTE (no DEFINITION FOUND]
       do (HELP OFN (QUOTE (rename failed -- RETURN to try again])

(RENAMEDVAL
  [LAMBDA (VAL)                                              (* lmm " 5-APR-82 13:02")
    (SETQ RENAMEALIST (EVALV SUBNAME))
    (RESETVARS ((NOSPELLFLG T)
		(DWIMESSGAG T)
		(DWIMFLG)
		(DWIMUSERFORMS))
	       (RETURN (RNSUBST VAL])

(MAKECOMP
  [LAMBDA (FILE COMS)                                        (* lmm " 5-APR-82 13:01")
    (PROG (FULL)
          (SETATOMVAL (FILECOMS FILE)
		      COMS)
          [RESETVARS (PRETTYFLG (COPYRIGHTFLG (QUOTE NEVER))
				USEMAPFLG BUILDMAPFLG MAKEFILEREMAKEFLG)
		     (SETQ FULL (MAKEFILE FILE (QUOTE (NEW]
          (LISPXUNREAD (QUOTE (F)))
          (RETURN (LIST FULL (RESETVARS (DONTCOMPILEFNS)
				        (RETURN (BRECOMPILE FULL NIL (QUOTE ALL])

(RNSUBST
  [LAMBDA (X)                                                (* rrb "13-DEC-82 11:39")
    (COND
      ((NLISTP X)
	(OR (CDR (FASSOC X RENAMEALIST))
	    X))
      (T (PROG ((A (CAR X)))
	       (COND
		 ((LISTP A)
		   (GO LST)))
	       [RETURN (SELECTQ A
				[(fetch ffetch freplace replace create add type? if)
				  (RNSUBST (OR (GETHASH (RECORDTRAN X (SELECTQ A
									       (add (QUOTE CHANGETRAN)
										    )
									       NIL))
							CLISPARRAY)
					       (PROGN (HELP X "DWIM failed")
						      X]
				(* (QUOTE (*)))
				[LOCAL (COND
					 [(LISTP (CADR X))
					   (CONS (CAADR X)
						 (MAPCAR (CDADR X)
							 (FUNCTION RNSUBST]
					 (T (CADR X]
				[UNLESSRDSYS (SELECTQ RENAMETYPE
						      (R (RNSUBST (CADDR X)))
						      (RNSUBST (CADR X]
				(ALLOCAL (CADR X))
				[OPENLAMBDA (CONS (QUOTE LAMBDA)
						  (RNSUBST (CDR X]
				(COND
				  [(SETQ A (CDR (FASSOC A RENAMEALIST)))
				    (RNSUBST (CONS A (CDR X]
				  ((FMEMB (CAR X)
					  EXPANDMACROFNS)
				    [RESETVARS [(COMPILERMACROPROPS (QUOTE (DMACRO ALTOMACRO 
										   BYTEMACRO MACRO]
					       (COND
						 ((EQUAL X (SETQ X (EXPANDMACRO X T)))
						   (HELP X (QUOTE "macro expansion failed"]
				    (RNSUBST X))
				  (T (SETQ A (DOCOLLECT (CAR X)))
				     (GO NXT]
	   LST (SETQ A)
	   DLP (SETQ A (DOCOLLECT (RNSUBST (CAR X))
				  A))
	   NXT (AND (LISTP (SETQ X (CDR X)))
		    (GO DLP))
	       (RETURN (ENDCOLLECT A (RNSUBST X])
)
(FILESLOAD (SOURCE)
	   FILESETS)
[DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY
(BLOCK: RNSUBST RNSUBST (NOLINKFNS . T))
]
(DECLARE: DONTCOPY (PUTPROPS RENAMEFNS COPYRIGHT ("Xerox Corporation" 3676Q)))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (715Q 12341Q (DORENAME 727Q . 1440Q) (DORENAME0 1442Q . 5037Q) (RENAMEFN 5041Q . 6011Q) 
(RENAMEDVAL 6013Q . 6416Q) (MAKECOMP 6420Q . 7350Q) (RNSUBST 7352Q . 12337Q)))))
STOP