Package hierarchy graphs with McCLIM's listener - Lisp Propulsion Laboratory log

Lisp Propulsion Laboratory log

Paolo Amoroso's weblog. Main interests: Lisp, astronomy (Moon), space exploration (Apollo and early manned programs) Calendar of past entries | Related links xml

Package hierarchy graphs with McCLIM's listener

Friday, August 27, 2004

Graphs often make for cool screen shots. So, I have written a couple of new McCLIM listener commands for displaying package hierarchy graphs.

This code implements the commands Show Package Users and Show Used Packages for drawing graphs of, respectively, the packages that use the argument package and the ones used by it. Both commands take a single optional argument, a package name (string) or a package. The default is the value of *package*.

Each node contains the package name followed by a pair of numbers in parentheses, the number of internal and external symbols, like this: PKG-NAME (internal/external). If the package has no external symbols, the node is gray.

The screen shots below show sample output of these commands in a typical CMUCL image with McCLIM and other tools (SLIME and ASDF) under Linux. EXTENSIONS is an implementation-specific CMUCL package. Playing with such graphs is interesting, they unearth complex relationships among packages.

Graph of the packages that use the CL package in a typical CMUCL image with McCLIM under Linux. Created with McCLIM's listener.

Graph of the packages used by CMUCL's EXTENSIONS package in a typical image with McCLIM loaded under Linux. Created with McCLIM's listener.

The code, which you can compile and load into the listener, is based on the listener's class graphing function and commands. The new commands call the CLIM grapher with appropriate arguments, i.e. functions for generating the children of a node: cl:package-use-list and cl:package-used-by-list in this case. If you don't use CMUCL, be sure to customize count-internal-symbols and count-external-symbols for your Lisp.

If these commands are ever added to the listener's CVS sources, it may be worth considering factoring the class/package graphing functionality.


Copyright © 2004 by Paolo Amoroso
amoroso@mclink.it

Created with BlogMax

August 2004
Mon Tue Wed Thu Fri Sat Sun
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
Jul  Sep
About Lisp | Practical Common Lisp (learn Lisp) | Planet Lisp (blog agregator) | Common Lisp Directory (software and resources) | Why Lisp?