unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Code to caller graph
@ 2010-12-14 17:41 Andrea Crotti
  2010-12-15 16:51 ` Andrea Crotti
       [not found] ` <mailman.13.1292431916.4561.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Andrea Crotti @ 2010-12-14 17:41 UTC (permalink / raw)
  To: help-gnu-emacs

I have a C++ project with a lot of intricated C++ code, and sometimes
it's very useful to look in the doxygen generated pages.

It would be really great if in one key combination I could jump from the
function definition in emacs to the image showing the call/caller graph.

I see though that the full addresses of the image graphsin doxygen is
something complicated like this:

doc/html/class_pad_node_a6b918365cac3efcf5201c01ffa654c21_cgraph.png

Anyone did it or has any ideas?




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Code to caller graph
  2010-12-14 17:41 Code to caller graph Andrea Crotti
@ 2010-12-15 16:51 ` Andrea Crotti
       [not found] ` <mailman.13.1292431916.4561.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Andrea Crotti @ 2010-12-15 16:51 UTC (permalink / raw)
  To: help-gnu-emacs

Andrea Crotti <andrea.crotti.0@gmail.com> writes:

> I have a C++ project with a lot of intricated C++ code, and sometimes
> it's very useful to look in the doxygen generated pages.
>
> It would be really great if in one key combination I could jump from the
> function definition in emacs to the image showing the call/caller graph.
>
> I see though that the full addresses of the image graphsin doxygen is
> something complicated like this:
>
> doc/html/class_pad_node_a6b918365cac3efcf5201c01ffa654c21_cgraph.png
>
> Anyone did it or has any ideas?

Well if someone is interested

--8<---------------cut here---------------start------------->8---
(defun un-camelcase-string (s &optional sep start)
  "Convert CamelCase string S to lower case with word separator SEP.
    Default for SEP is a hyphen \"-\".
    If third argument START is non-nil, convert words after that
    index in STRING."
  (let ((case-fold-search nil))
    (while (string-match "[A-Z]" s (or start 1))
      (setq s (replace-match (concat (or sep "-") 
                                     (downcase (match-string 0 s))) 
                             t nil s)))
    (downcase s)))

(defun doxy-path (basepath classname)
  (concat basepath "doc/html/class_" (un-camelcase-string classname "_") ".html"))

(defun jump-to-doxygen-doc (basepath)
  "jump to the corresponding doxygen page"
  (interactive "D")
  (let*
      ((nondir (file-name-nondirectory (buffer-file-name)))
       (classname (nth 0 (split-string nondir "\\."))))
    (browse-url (doxy-path basepath classname))))
--8<---------------cut here---------------end--------------->8---

it works fine for me, given that the class name is the same of the file
name.

doxygen also uncamelise names, so PadCoordinate.cpp doc will be in
pad_coordinate.html
for example.

I can't see the graph directly in emacs but to have the right page pop
up is already quite nice...




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Code to caller graph
       [not found] ` <mailman.13.1292431916.4561.help-gnu-emacs@gnu.org>
@ 2010-12-15 22:42   ` Elena
  2010-12-17 23:07     ` Andrea Crotti
       [not found]     ` <mailman.4.1292627273.6551.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Elena @ 2010-12-15 22:42 UTC (permalink / raw)
  To: help-gnu-emacs

On Dec 15, 5:51 pm, Andrea Crotti <andrea.crott...@gmail.com> wrote:
> Andrea Crotti <andrea.crott...@gmail.com> writes:
> > I have a C++ project with a lot of intricated C++ code, and sometimes
> > it's very useful to look in the doxygen generated pages.
>
> > It would be really great if in one key combination I could jump from the
> > function definition in emacs to the image showing the call/caller graph.
>
> > I see though that the full addresses of the image graphsin doxygen is
> > something complicated like this:
>
> > doc/html/class_pad_node_a6b918365cac3efcf5201c01ffa654c21_cgraph.png
>
> > Anyone did it or has any ideas?
>
> Well if someone is interested
>
> --8<---------------cut here---------------start------------->8---
> (defun un-camelcase-string (s &optional sep start)
>   "Convert CamelCase string S to lower case with word separator SEP.
>     Default for SEP is a hyphen \"-\".
>     If third argument START is non-nil, convert words after that
>     index in STRING."
>   (let ((case-fold-search nil))
>     (while (string-match "[A-Z]" s (or start 1))
>       (setq s (replace-match (concat (or sep "-")
>                                      (downcase (match-string 0 s)))
>                              t nil s)))
>     (downcase s)))
>
> (defun doxy-path (basepath classname)
>   (concat basepath "doc/html/class_" (un-camelcase-string classname "_") ".html"))
>
> (defun jump-to-doxygen-doc (basepath)
>   "jump to the corresponding doxygen page"
>   (interactive "D")
>   (let*
>       ((nondir (file-name-nondirectory (buffer-file-name)))
>        (classname (nth 0 (split-string nondir "\\."))))
>     (browse-url (doxy-path basepath classname))))
> --8<---------------cut here---------------end--------------->8---
>
> it works fine for me, given that the class name is the same of the file
> name.
>
> doxygen also uncamelise names, so PadCoordinate.cpp doc will be in
> pad_coordinate.html
> for example.
>
> I can't see the graph directly in emacs but to have the right page pop
> up is already quite nice...

What about the hash part:

> doc/html/class_pad_node_***a6b918365cac3efcf5201c01ffa654c21***_cgraph.png

?

Maybe, since the address of the HTML page  is guessable, he could
parse such page looking for the PNG image.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Code to caller graph
  2010-12-15 22:42   ` Elena
@ 2010-12-17 23:07     ` Andrea Crotti
       [not found]     ` <mailman.4.1292627273.6551.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Andrea Crotti @ 2010-12-17 23:07 UTC (permalink / raw)
  To: help-gnu-emacs

Elena <egarrulo@gmail.com> writes:
>
> ?
>
> Maybe, since the address of the HTML page  is guessable, he could
> parse such page looking for the PNG image.

Mm yes sure not a bad idea I didn't think about that ;)
Another thing which I would like to know is how to pass

/very/long/path/name.ext -> name

What I do now is this:

 ((nondir (file-name-nondirectory (buffer-file-name)))
  (classname (nth 0 (split-string nondir "\\."))))

but well, not that nice...




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Code to caller graph
       [not found]     ` <mailman.4.1292627273.6551.help-gnu-emacs@gnu.org>
@ 2010-12-17 23:49       ` Elena
  0 siblings, 0 replies; 5+ messages in thread
From: Elena @ 2010-12-17 23:49 UTC (permalink / raw)
  To: help-gnu-emacs

On Dec 18, 12:07 am, Andrea Crotti <andrea.crott...@gmail.com> wrote:
> Elena <egarr...@gmail.com> writes:
>
> > ?
>
> > Maybe, since the address of the HTML page  is guessable, he could
> > parse such page looking for the PNG image.
>
> Mm yes sure not a bad idea I didn't think about that ;)
> Another thing which I would like to know is how to pass
>
> /very/long/path/name.ext -> name

(file-name-sans-extension (file-name-nondirectory "/very/long/path/
name.ext")) ;; -> name


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-12-17 23:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-14 17:41 Code to caller graph Andrea Crotti
2010-12-15 16:51 ` Andrea Crotti
     [not found] ` <mailman.13.1292431916.4561.help-gnu-emacs@gnu.org>
2010-12-15 22:42   ` Elena
2010-12-17 23:07     ` Andrea Crotti
     [not found]     ` <mailman.4.1292627273.6551.help-gnu-emacs@gnu.org>
2010-12-17 23:49       ` Elena

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).