This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: GOOPS's class hierarchy


Keisuke Nishida <kxn30@po.cwru.edu> writes:

> Does anyone have a graphical figure of GOOPS's class hierarchy
> or a graph generator?

Yes, I wrote it...

(use-modules (oop goops))

(define (class-string-name class)
  (if (slot-bound? class 'name)
      (string-append "\"" (class-name class) "\"")
      "\"#<anonymous>\""))

(define (build-dotty-graph class)
  (let ((name (class-string-name class)))
    (for-each (lambda (subclass)
		(display " ")
		(display name)
		(display "->")
		(display (class-string-name subclass))
		(newline)
		(build-dotty-graph subclass))
	      (class-direct-subclasses class))))

(display "digraph G {\n")
(build-dotty-graph <top>)
(display "}\n")

Output:

  http://www.research.att.com/~north/cgi-bin/webdot.cgi/http://home.cwru.edu/~kxn30/hierarchy.dot.gif

Thanks to webdot:

  http://www.research.att.com/~north/cgi-bin/webdot.cgi

Thanks,
Keisuke Nishida

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]