Re: xref



CY did some work on that last year.  I also sent him a list of all the public symbols
in maxima, as a documentation start.  I also created a list of short functions,
to try to start the documentation effort on those.
Dan Stanger


Martin RUBEY wrote:

> > Yes.  I think that's also a good idea, if someone wants to take the
> > time to figure out which routines are really separate or not.  (I
> > didn't look.)
>
> Here is a first attempt to do so, using
>
> http://www-2.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/tools/xref/
>
> To get a picture what functions of combin.lisp are used outside, do:
>
> (load "/net/t1/rubey/.maxima/xref/xref.o")
> (xref:DEFINE-CALLER-PATTERN-SYNONYMS defun (defmfun))
>
> ; find all functions in combin.lisp
> (xref:xref-files "combin.lisp")
> (setq lst nil)
> (maphash #'(lambda (key value) (push key lst)) xref:*source-file*)
>
> ; xref doesn't like the following files. might be interesting to find out
> ; why
> (xref:xref-files
>  (remove-if #'(lambda (f)
>                 (member f '(#p"/net/t1/rubey/maxima/src/SYS-DECLAIM.lisp"
>                              #p"/net/t1/rubey/maxima/src/SYS-PROCLAIM.lisp"
>                               #p"/net/t1/rubey/maxima/src/acall.lisp"
>                               #p"/net/t1/rubey/maxima/src/bessel.lisp"
>                               #p"/net/t1/rubey/maxima/src/cl-info.lisp"
>                               #p"/net/t1/rubey/maxima/src/csimp2.lisp"
>                               #p"/net/t1/rubey/maxima/src/displa.lisp"
>                               #p"/net/t1/rubey/maxima/src/float.lisp"
>                               #p"/net/t1/rubey/maxima/src/fortra.lisp"
>                               #p"/net/t1/rubey/maxima/src/grind.lisp"
>                               #p"/net/t1/rubey/maxima/src/init-cl.lisp"
>                               #p"/net/t1/rubey/maxima/src/ldisp.lisp"
>                               #p"/net/t1/rubey/maxima/src/macsys.lisp"
>                            #p"/net/t1/rubey/maxima/src/maxima-package.lisp"
>                               #p"/net/t1/rubey/maxima/src/misc.lisp"
>                               #p"/net/t1/rubey/maxima/src/mlisp.lisp"
>                               #p"/net/t1/rubey/maxima/src/mload.lisp"
>                               #p"/net/t1/rubey/maxima/src/nparse.lisp"
>                               #p"/net/t1/rubey/maxima/src/simp.lisp"
>                               #p"/net/t1/rubey/maxima/src/suprv1.lisp"
>                               #p"/net/t1/rubey/maxima/src/trigi.lisp")
>                         :test #'equal))
>             (directory "/net/t1/rubey/maxima/src/*.lisp")))
>
> ; find out which functions are called outside
> (mapcan #'(lambda (symb)
>             (let ((flist (remove "combin.lisp"
>                                  (delete-duplicates
>                                   (mapcar #'file-namestring
>                                           (xref:what-files-call symb))
>                                   :test #'equal)
>                                  :test #'equal)))
>               (when flist (list (cons symb flist)))))
>         lst)
>
> result:
>
> ((POLYDECOMP "solve.lisp")
>  ($CFEXPAND "option.lisp")
>  ($CFDISREP "option.lisp")
>  (CF "residu.lisp" "hypgeo.lisp")
>  ($FIB "option.lisp")
>  ($ZETA "specfn.lisp" "option.lisp" "mactex.lisp")
>  ($BERNPOLY "option.lisp")
>  ($BERN "option.lisp" "hayat.lisp")
>  ($FACTCOMB "option.lisp")
>  (SUM "trans1.lisp" "sumcon.lisp" "spgcd.lisp" "specfn.lisp"
>       "solve.lisp" "sloop.lisp" "risch.lisp" "rat3a.lisp" "pois3.lisp"
>       "pois2.lisp" "plot.lisp" "numth.lisp" "nrat4.lisp" "newinv.lisp"
>       "mat.lisp" "linnew.lisp" "limit.lisp" "homog.lisp" "hayat.lisp"
>       "asum.lisp")
>  (SIMPSUM2 "asum.lisp")
>  ($QUNIT "option.lisp")
>  ($EULER "option.lisp" "hayat.lisp")
>  ($MINFACTORIAL "option.lisp" "limit.lisp")
>  ($MAKEGAMMA "defint.lisp")
>  ($MAKEFACT "limit.lisp" "comm.lisp")
>  ($TAYTORAT "ratout.lisp" "rat3e.lisp" "nisimp.lisp" "inmis.lisp"))
>
> well, this is only half of the story: it *seems* that some functions are
> not called at all:
>
> (mapcan #'(lambda (symb)
>             (let ((flist (delete-duplicates
>                            (mapcar #'file-namestring
>                                    (xref:what-files-call symb))
>                            :test #'equal)))
>               (unless flist (list (cons symb flist)))))
>         lst)
>
> ((SRRAT) (CF-CONVERGENTS-P-Q) (CFQUOT) (CFMIN) (CFDIFF) (CFPLUS)
>  (SIMPPROD) (SIMPBERN) (SIMPEULER) ($POLYDECOMP))
>
> but:
> grep -i srrat *
>
> shows that this is not quite so:
>
> combin.lisp:    ((catch 'srrat (srrat e)))
>
> or:
> grep -i cfquot *
> combin.lisp:  ((setq temp (assq (caar a) '((mplus . cfplus)
>                                            (mtimes . cftimes)
>                                            (mquotient . cfquot)
>
> I don't really understand why what-files-call doesn't find these. Of
> course it doesn't find the stuff in simp.lisp, because xref cannot process
> simp.lisp at all...
>
> OK, (setq MACHINE-MANTISSA-PRECISION nil) lets xref process simp.lisp,
> still it doesn't get SIMPPROD:
>
> grep -i SIMPPROD *
> simp.lisp: (%PLOG SIMPPLOG) (%PRODUCT SIMPPROD) (%GENFACT SIMPGFACT)
>
> which is part of the statement
> (PROG1 '(OPERATORS properties)
>       (MAPC #'(LAMBDA (X) (PUTPROP (CAR X) (CADR X) 'OPERATORS))
>       ...
>
> But its a start, I think
>
> Martin
>
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima