Subject: Using doxygen (or something similar) to generate API docs [was [PATCH 4/4] Add a function string_list_longest_prefix()]

From: Michael Haggerty <[email-masked]>
Date: Mon, 10 Sep 2012 21:21:12 +0200

I'm renaming this thread so that the bikeshedding can get over ASAP.

On 09/10/2012 07:48 PM, Andreas Ericsson wrote:
> On 09/10/2012 06:33 PM, Jeff King wrote:
>> On Mon, Sep 10, 2012 at 09:24:17AM -0700, Junio C Hamano wrote:
>>> Michael Haggerty <[email-masked]> writes:
>>>> Also, better documentation in header files could enable the automatic
>>>> generation of API docs (e.g., via doxygen).
>>>
>>> Yeah, perhaps you may want to look into doing an automated
>>> generation of Documentation/technical/api-*.txt files out of the
>>> headers.
>>
>> I was just documenting something in technical/api-* the other day, and
>> had the same feeling. I'd be very happy if we moved to some kind of
>> literate-programming system. I have no idea which ones are good or bad,
>> though. I have used doxygen, but all I remember is it being painfully
>> baroque. I'd much rather have something simple and lightweight, with an
>> easy markup format. For example, this:
>>
>>    http://tomdoc.org/
>>
>> Looks much nicer to me than most doxygen I've seen. But again, it's been
>> a while, so maybe doxygen is nicer than I remember.

I don't have a personal preference for what system is used.  I mentioned
doxygen only because it seems to be a well-known example.

>>From a glance at the URL you mentioned, it looks like TomDoc is only
applicable to Ruby code.

> Doxygen has a the very nifty feature of being able to generate
> callgraphs though. We use it extensively at $dayjob, so if you need a
> hand building something sensible out of git's headers, I'd be happy
> to help.

My plate is full.  If you are able to work on this, it would be awesome.
 As far as I'm concerned, you are the new literate documentation czar :-)

Most importantly, having a convenient system of converting header
comments into documentation would hopefully motivate other people to add
better header comments in the first place, and motivate reviewers to
insist on them.  It's shocking (to me) how few functions are documented,
and how often I have to read masses of C code to figure out what a
function is for, its pre- and post-conditions, its memory policy, etc.
Often I find myself having to read functions three layers down the call
tree to figure out the behavior of the top-layer function.  I try to
document things as I go, but it's only a drop in the bucket.

> libgit2 uses doxygen btw, and has done since the start. If we ever
> merge the two, it would be neat to use the same.

That would be a nice bonus.

Michael

-- 
Michael Haggerty
[email-masked]
http://softwareswirl.blogspot.com/