From: Joubert Nel
Subject: Visualize class inheritance
Date: 
Message-ID: <1190580315.883288.135880@r29g2000hsg.googlegroups.com>
Hi,

Does anybody use a tool that can take a bunch of files with CL code
and generate a graphic that shows the inheritance tree of classes
defined in those files?

Joubert

PS: I don't care about the slots, generic functions, methods, etc.

From: Frank Goenninger DG1SBG
Subject: Re: Visualize class inheritance
Date: 
Message-ID: <lz6421qc0y.fsf@pcsde001.de.goenninger.net>
Joubert Nel <···········@gmail.com> writes:

> Hi,
>
> Does anybody use a tool that can take a bunch of files with CL code
> and generate a graphic that shows the inheritance tree of classes
> defined in those files?
>
> Joubert
>
> PS: I don't care about the slots, generic functions, methods, etc.
>

Hi -

I am enjoying the LispWorks IDE now for about three days and I just
love it. It does have a class browser - and a function call browser, a
system browser, a ... well, lot's of stuff. LW Personal
Edition. Free. Installs in 5 min (including DL time for me).

Frank

-- 

  Frank Goenninger

  frgo(at)mac(dot)com

  "Don't ask me! I haven't been reading comp.lang.lisp long enough to 
  really know ..."
From: Ken Tilton
Subject: Re: Visualize class inheritance
Date: 
Message-ID: <AZGJi.227$Vi4.205@newsfe12.lga>
Frank Goenninger DG1SBG wrote:
> Joubert Nel <···········@gmail.com> writes:
> 
> 
>>Hi,
>>
>>Does anybody use a tool that can take a bunch of files with CL code
>>and generate a graphic that shows the inheritance tree of classes
>>defined in those files?
>>
>>Joubert
>>
>>PS: I don't care about the slots, generic functions, methods, etc.
>>
> 
> 
> Hi -
> 
> I am enjoying the LispWorks IDE now for about three days and I just
> love it. It does have a class browser - and a function call browser, a
> system browser, a ... well, lot's of stuff. LW Personal
> Edition. Free. Installs in 5 min (including DL time for me).

The interesting thing to me is that the OP asked for something vastly 
different and un-Lispy. You describe a Lisp compiler, repl, and full 
blown IDE, he just wants to get from Lisp source to a reasonable 
visualization. Yes, a compiler/IDE is a "tool", but I am somehow hearing 
  "without compiling the whole damn thing".

If I am mistaken, the tool I would suggest is PRINT.

kenny

-- 
http://www.theoryyalgebra.com/

"We are what we pretend to be." -Kurt Vonnegut
From: Frank Goenninger DG1SBG
Subject: Re: Visualize class inheritance
Date: 
Message-ID: <lz1wcor08g.fsf@pcsde001.de.goenninger.net>
Ken Tilton <···········@optonline.net> writes:

> Frank Goenninger DG1SBG wrote:
>> Joubert Nel <···········@gmail.com> writes:
>>
>>
>>>Hi,
>>>
>>>Does anybody use a tool that can take a bunch of files with CL code
>>>and generate a graphic that shows the inheritance tree of classes
>>>defined in those files?
>>>
>>>Joubert
>>>
>>>PS: I don't care about the slots, generic functions, methods, etc.
>>>
>>
>>
>> Hi -
>>
>> I am enjoying the LispWorks IDE now for about three days and I just
>> love it. It does have a class browser - and a function call browser, a
>> system browser, a ... well, lot's of stuff. LW Personal
>> Edition. Free. Installs in 5 min (including DL time for me).
>
> The interesting thing to me is that the OP asked for something vastly
> different and un-Lispy. You describe a Lisp compiler, repl, and full
> blown IDE, he just wants to get from Lisp source to a reasonable
> visualization. Yes, a compiler/IDE is a "tool", but I am somehow
> hearing "without compiling the whole damn thing".
>
> If I am mistaken, the tool I would suggest is PRINT.
>
> kenny

Yup - that might be it. I was relating this question to myself being
in search for a tool that prints the class tree for Cello. The "tool"
I ended up with was is "Code Reading". Yes, because even with Slime's
class browser I was /only/ able to browse subclasses of a given
class and drill down from that point on (but maybe I was missing
something in Slime's class browseR ?)

That leaves you with the question what the top or root classes
actually are... - down to code reading again. Of course you could
write your own class/inheritance tree viewer with some MOPery and
stuff. I had that "Yeah - that's it!" feeling only with the IDE -
compiling the whole stuff (even Cello) is a matter of seconds. 

So, I was implying "navigation" into the OPs request, yes. Because
that allows you to explore NIH code. Something I still do - even
after three years of Cello, Cells, Celtk, OpenGL exposure ;-)

Frank

-- 

  Frank Goenninger

  frgo(at)goenninger(dot)net

  "Don't ask me! I haven't been reading comp.lang.lisp long enough to 
  really know ..."
From: Numeromancer
Subject: Re: Visualize class inheritance
Date: 
Message-ID: <3P7Ki.11269$924.6055@newssvr23.news.prodigy.net>
Ken Tilton wrote:

> If I am mistaken, the tool I would suggest is PRINT.
> 
> kenny

What would you suggest if you are not mistaken?

Tim S
From: Ken Tilton
Subject: Re: Visualize class inheritance
Date: 
Message-ID: <Sj9Ki.27$Ac7.26@newsfe12.lga>
Numeromancer wrote:
> Ken Tilton wrote:
> 
>> If I am mistaken, the tool I would suggest is PRINT.
>>
>> kenny
> 
> 
> What would you suggest if you are not mistaken?

Make me mistaken.

kenny

-- 
http://www.theoryyalgebra.com/

"We are what we pretend to be." -Kurt Vonnegut
From: Numeromancer
Subject: Re: Visualize class inheritance
Date: 
Message-ID: <6haKi.1121$hI7.80@newssvr17.news.prodigy.net>
Ken Tilton wrote:
> 
> 
> Numeromancer wrote:
>> Ken Tilton wrote:
>>
>>> If I am mistaken, the tool I would suggest is PRINT.
>>>
>>> kenny
>>
>>
>> What would you suggest if you are not mistaken?
> 
> Make me mistaken.
> 
> kenny

Mistaken or mis-taken?

Tim S

 > "We are what we pretend to be." -Kurt Vonnegut

I am pretending to be someone I'm not.
From: George Neuner
Subject: Re: Visualize class inheritance
Date: 
Message-ID: <bjlif3pfhrus8ct9kdiatv34qaq8ubk551@4ax.com>
On Tue, 25 Sep 2007 12:01:37 -0400, Numeromancer <·@y.net> wrote:

>Ken Tilton wrote:
>> 
>> Numeromancer wrote:
>>> Ken Tilton wrote:
>>>
>>>> If I am mistaken, the tool I would suggest is PRINT.
>>>>
>>>> kenny
>>>
>>> What would you suggest if you are not mistaken?
>> 
>> Make me mistaken.
>> 
>> kenny
>
>Mistaken or mis-taken?

Kenny thought he was mistaken once ... but he was wrong.

George
--
for email reply remove "/" from address
From: Tayssir John Gabbour
Subject: Re: Visualize class inheritance
Date: 
Message-ID: <1190620310.107435.290520@y42g2000hsy.googlegroups.com>
Hi,

On Sep 23, 10:45 pm, Joubert Nel <···········@gmail.com> wrote:
> Does anybody use a tool that can take a bunch of files with CL code
> and generate a graphic that shows the inheritance tree of classes
> defined in those files?

Marc Battyani gave a presentation where he demonstrated such a tool. I
assume he piped the inheritance relationships to graphviz. (Using the
metaobject protocol rather than using READ to parse the files.)
http://www.graphviz.org/

There's a couple graphviz libraries available, of which I know
nothing:
http://www.martin-loetzsch.de/S-DOT/index.html
http://common-lisp.net/project/cl-graphviz/

The humorous context was that he was asked to prototype a project, for
later reimplementation by a team of Java programmers. He printed out
like a thousand automatically-generated pages of documentation (he
does author cl-pdf after all...), with complex class structures using
multiple-inheritance, and the decisionmakers decided to go with his
"prototype."


Tayssir
From: ddd
Subject: Re: Visualize class inheritance
Date: 
Message-ID: <slrnffetmv.3no.ddd@localhost.localdomain>
On Sun, 23 Sep 2007 20:45:15 -0000, Joubert Nel <···········@gmail.com> wrote:
> Hi,
>
> Does anybody use a tool that can take a bunch of files with CL code
> and generate a graphic that shows the inheritance tree of classes
> defined in those files?
>
> Joubert
>
> PS: I don't care about the slots, generic functions, methods, etc.
>

maybe http://ecb.sourceforge.net/ can help you (based on emacs).
(see also semantic and speedbar for emacs)
From: Rainer Joswig
Subject: Re: Visualize class inheritance
Date: 
Message-ID: <joswig-FB029B.10231424092007@news-europe.giganews.com>
In article <························@r29g2000hsg.googlegroups.com>,
 Joubert Nel <···········@gmail.com> wrote:

> Hi,
> 
> Does anybody use a tool that can take a bunch of files with CL code
> and generate a graphic that shows the inheritance tree of classes
> defined in those files?
> 
> Joubert
> 
> PS: I don't care about the slots, generic functions, methods, etc.

I haven't seen such a thing.

But it should not be that hard to write one. You
need to READ through source files to find DEFCLASS
(and related). Additionally you want to make sure
it knows something about packages.

There is a cross referencer in the Kantrowitz utilities.
It would be a nice project to hack it, so that it also
records class inheritance.

http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/tools/xref/0.html
http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/tools/xref/xref.tgz

-- 
http://lispm.dyndns.org
From: Tayssir John Gabbour
Subject: Re: Visualize class inheritance
Date: 
Message-ID: <1190624479.982176.211870@k79g2000hse.googlegroups.com>
On Sep 24, 10:23 am, Rainer Joswig <······@lisp.de> wrote:
> > Does anybody use a tool that can take a bunch of files with CL code
> > and generate a graphic that shows the inheritance tree of classes
> > defined in those files?
>
> I haven't seen such a thing.
>
> But it should not be that hard to write one. You
> need to READ through source files to find DEFCLASS
> (and related). Additionally you want to make sure
> it knows something about packages.

Interesting, why READ instead of the MOP?

(Clarification to my earlier post -- I don't actually know/remember
what Marc used to do his report.)


Tayssir
From: Madhu
Subject: Re: Visualize class inheritance
Date: 
Message-ID: <m3lkawtf9w.fsf@robolove.meer.net>
* Tayssir John Gabbour <························@k79g2000hse.XXXXXX> :
|
| On Sep 24, 10:23 am, Rainer Joswig wrote:
|> > Does anybody use a tool that can take a bunch of files with CL code
|> > and generate a graphic that shows the inheritance tree of classes
|> > defined in those files?
|>
|> I haven't seen such a thing.
|>
|> But it should not be that hard to write one. You
|> need to READ through source files to find DEFCLASS
|> (and related). Additionally you want to make sure
|> it knows something about packages.
|
| Interesting, why READ instead of the MOP?

READ with *READ-EVAL* set to NIL, because you do not want to load the
code in the files but just produce the graph.  But you would not produce
a decent class hierarchy without using the MOP.

You could use the `PSGRAPH' from the CMU AI repository (which used to be
shipped under ACL and CMUCL contribs) to produce a type hierarchy using
the DUMP-PS function I outline below.

With a small hack, the PSGRAPH package can also be made to produce
graphviz output: See DUMP-DOT below for a sketch

(defun dump-ps (class-name &key (output-file #P"type-hierarchy.ps")
                (children-function #'mop:class-direct-subclasses))
  "Dump a class hierarchy rooted at CLASS-NAME to a postscript file
OUTPUT-FILE. Use MOP:CLASS-DIRECT-SUPERCLASSES as CHILDREN-FUNCTION to
dump the class hierarchy ending in CLASS-NAME."
  (check-type class-name symbol "Need a class name")
  (with-open-file (stream output-file :direction :output :if-exists :supersede)
    (psgraph:psgraph  stream class-name
                      #'(lambda (p)
                          (mapcar #'class-name
                                  (funcall children-function (find-class p))))
                      #'(lambda (s) (list (symbol-name s)))
                      t)))

(defun dump-dot (class-name &key (output-file #P"type-hierarchy.dot")
                 (graph-name (symbol-name class-name))
                (children-function #'mop:class-direct-subclasses))
  (let* (($narray (make-array 5000 :initial-element nil)) ;; of 'psgraph::psnode
         ($psnode-index (make-hash-table :test #'equal :size 500
                                         :rehash-size 2.0))
         (psgraph::*num-psnodes* 0)
         (psgraph::*narray* $narray)
         (psgraph::*psnode-index* $psnode-index))
    (psgraph::walk-graph class-name
                         #'(lambda (p)
                             (mapcar #'class-name
                                     (funcall children-function
                                              (find-class p))))
                         #'(lambda (p) (list (symbol-name p))))
    (with-open-file (stream output-file :direction :output
                            :if-exists :supersede)
      (format stream "digraph ~S {~&" graph-name)
      (loop for name being each hash-key of $psnode-index
            using (hash-value psnode-index)
            for psnode = (aref $narray psnode-index)
            for child-indices = (psgraph::psnode-children psnode)
            when child-indices
            do (format stream "~t~{~s~^ ~} -> {~{~{~s~^ ~}~^ ~}};~&"
                       (psgraph::psnode-info psnode)
                       (mapcar (user::compose  (lambda (x)
                                                 (psgraph::psnode-info
                                                  (aref $narray x))))
                               child-indices)))
      (format stream "~&};~&"))))

#||
(dump-ps 'http::basic-log-mixin
         :children-function #'mop:class-direct-subclasses)
(dump-dot 'http::server
         :children-function #'mop:class-direct-superclasses)
||#

--
Madhu
From: Thomas A. Russ
Subject: Re: Visualize class inheritance
Date: 
Message-ID: <ymid4w8561m.fsf@blackcat.isi.edu>
Joubert Nel <···········@gmail.com> writes:

> Hi,
> 
> Does anybody use a tool that can take a bunch of files with CL code
> and generate a graphic that shows the inheritance tree of classes
> defined in those files?

Well, it didn't work from files, but rather from the class defintions
themselves, but MCL came with a graphical class browser.

You could also try  <http://tinyurl.com/27pkcs>
  short form of <http://www.lirmm.fr/~lafourcade/ML-Lisp/Lisp-src/MCL%20sources/Various/Geta%20Projects%20(3.0)/Managers%20:c4/geta-grapher%20Folder/>

It's actually pretty easy to write a text-based outliner as well, and it
would make a nice beginner's project for using some of the CLOS
introspection.

-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: Zach Beane
Subject: Re: Visualize class inheritance
Date: 
Message-ID: <m3sl54p1pz.fsf@unnamed.xach.com>
Joubert Nel <···········@gmail.com> writes:

> Hi,
>
> Does anybody use a tool that can take a bunch of files with CL code
> and generate a graphic that shows the inheritance tree of classes
> defined in those files?
>
> Joubert
>
> PS: I don't care about the slots, generic functions, methods, etc.

The output of http://weitz.de/capi-overview/ is neat, and would be an
interesting way to browse classes in general, not just CAPI classes.

Zach
From: Joubert Nel
Subject: Re: Visualize class inheritance
Date: 
Message-ID: <1190681304.225809.212860@50g2000hsm.googlegroups.com>
On Sep 24, 10:39 am, Zach Beane <····@xach.com> wrote:
> Joubert Nel <···········@gmail.com> writes:
> > Hi,
>
> > Does anybody use a tool that can take a bunch of files with CL code
> > and generate a graphic that shows the inheritance tree of classes
> > defined in those files?
>
> > Joubert
>
> > PS: I don't care about the slots, generic functions, methods, etc.
>
> The output ofhttp://weitz.de/capi-overview/is neat, and would be an
> interesting way to browse classes in general, not just CAPI classes.
>
> Zach

This visualization really rocks (http://weitz.de/capi-overview/capi/)
- it's simple but effective. Thanks for pointing it out - the concept
is perfect for what I'm looking for. I looked at the source that
generates the HTML and it is CAPI-specific, but it could be adapted to
READ/MOP-process (as pointed out by everyone above) any list of files
supplied to it.

Joubert