Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!umich!samsung!uunet!munnari.oz.au!yarra-glen!felix@AI.SRI.COM From: felix@AI.SRI.COM (Francois Felix INGRAND) Newsgroups: comp.lang.lisp Subject: Re: macro depencies generator Message-ID: <1064@yarra-glen.aaii.oz.au> Date: 12 Feb 90 02:54:08 GMT References: <1047@hunter.aaii.oz.au> Sender: felix@yarra-glen.aaii.oz.au Reply-To: felix@AI.SRI.COM (Francois Felix INGRAND) Organization: SRI International, Menlo Park, CA Lines: 34 In-reply-to: felix@AI.SRI.COM (Francois Felix INGRAND) In article <1047@hunter.aaii.oz.au>, I wrote: > >One trick would be to redefined defmacro such that it remembers where >the macro is defined (in file y), and at macro expansion time, it >prints a statement saying that file x (the one you are currently >compiling) is using file y. I am not sure how well this would deal >with defstruct access function though. I came up with something like this. It does the job for the macro defined by defmacro, but not for those defined by other means. It creates a list of lists. The car of each list is a file which is using the macro(s) defined in the file(s) listed in the cdr. (defvar *macro-dep* nil) (setf (macro-function 'old-defmacro) (macro-function 'defmacro)) (setf (macro-function 'new-defmacro) (macro-function 'defmacro)) (new-defmacro defmacro (name args &rest body) (setf (get name 'filename) lcl:*source-pathname*) `(old-defmacro ,name ,args (if (member lcl:*source-pathname* *macro-dep* :key #'car) (pushnew (get ',name 'filename) (cdar (member lcl:*source-pathname* *macro-dep* :key #'car))) (pushnew (list lcl:*source-pathname* (get ',name 'filename)) *macro-dep* :test #'equal)) ,@body)) -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Francois Felix INGRAND SRI International, AIC felix@AI.SRI.COM 333, Ravenswood Avenue felix%AI.SRI.COM@UUNET.UU.NET MENLO PARK, CA 94025, USA "Pourquoi tant de haine..." (Edika) "Read my Lisp... No new syntax" (nil)