[comp.sys.ti.explorer] a patch to defsystem allowing external module references

) (10/23/89)

OK, these go in package SYS. what they accomplish is allowing one
DEFSYSTEM to refer to modules in another DEFSYSTEM, which does not have
to be a component system (although I'd recommend that it is). This way,
if the other system has macros you're using, you can be sure you get
recompiled properly. (this could help you avoid those "... was compiled
with a different version of macro PUSH/SETF/...")

;;; -*- Mode:Common-Lisp;Package:SYSTEM;Base:10;Fonts:(*code-font*
*comment-font* *string-font* *other-string-font* *fn-name-font*);Patch-file:T -*-

;;;a CHANGE to these next two functions allows
;;;referencing modules external or component systems
;;;inside the current one.  can't say I think this is
;;;wise, but if you were dependent on some macros...

;;; Changed to call validate-external-module routine.  patch SYSTEM-3-30. -dkm 6/87

(DEFUN PARSE-MODULE-COMPONENTS (COMPONENTS SYSTEM)
  (COND ((PATHNAME-P COMPONENTS)	   ;a string or pathname object
	 (CONS (PARSE-MODULE-PATHNAME-LIST (CONS COMPONENTS NIL) SYSTEM) NIL))
	((SYMBOLP COMPONENTS)		   ;Single module within this system	
	 (LIST (FIND-MODULE-NAMED COMPONENTS SYSTEM)))	   ;return ((module-object))
	((not (listp COMPONENTS))
	 (FERROR nil "~S is not a recognized module component specification" COMPONENTS))
	((AND (SYMBOLP (CAR COMPONENTS))   ;list containing system followed by modules
	      ;if first symbol is a module, not external -dkm 6/87
	      (NOT (FIND-MODULE-NAMED (CAR COMPONENTS) SYSTEM T)))
	 (VALIDATE-EXTERNAL-MODULE COMPONENTS)	   ;parse external module spec is OK  -dkm 6/87

	 ;;this only occurs if the first element is a
	 ;;symbol specifying a component-system or other
	 ;;system. patch to return files, not a list.  TRP 10/89.
	 (MAPCAR #'(lambda (name)
		     (FIND-MODULE-NAMED name (CAR COMPONENTS)))	;(CAR COMPONENTS) names a system
		 (CDR COMPONENTS)))
	(T
	 (PARSE-MODULE-COMPONENT-LIST COMPONENTS SYSTEM))))

;;; Changed to call new validate-external-module routine, and to support a list
;;; modules, as documented in LISP manual. patch SYSTEM-3-30. -dkm 6/87

(DEFUN PARSE-MODULE-COMPONENT-LIST (COMPONENTS SYSTEM)
  (LOOP FOR COMPONENT IN COMPONENTS
	COLLECT (COND ((PATHNAME-P COMPONENT)
		       (PARSE-MODULE-PATHNAME-LIST (CONS COMPONENT NIL) SYSTEM))
		      ((SYMBOLP COMPONENT)
		       (FIND-MODULE-NAMED COMPONENT SYSTEM))
		      ((not (listp COMPONENT))
		       (FERROR nil "~S is not a recognized module component specification" COMPONENT))
		      ((SYMBOLP (CAR COMPONENT))           
		       (COND ((FIND-MODULE-NAMED (CAR COMPONENT) SYSTEM T)  ;support list of modules  -dkm 6/87
			      ;;LOOP removed--ugly. TRP 10/89
			      (DOLIST (module component)
				(PUSH (find-module-named module system) modules)))
			     (T (VALIDATE-EXTERNAL-MODULE COMPONENT)   ;must be an external spec  -dkm 6/87
				;;changed to allow referencing component or external systems --TRP 10/89.
				(DOLIST (module (CDR component))
				  (PUSH (find-module-named module (CAR COMPONENT)) modules)))))
		      ((PATHNAME-P (CAR COMPONENT))
		       (PARSE-MODULE-PATHNAME-LIST COMPONENT SYSTEM))
		      (T (FERROR nil "~S is not a recognized module
component specification" COMPONENT)))))

;;;END