samedi 27 juin 2015

How to use Doxygen with Prolog

I was struggling trying to make doxygen work with prolog.

At first I was only trying to include an "external and unknown" file, but as doxygen users know, it won't print a thing if it can't find useful (documented) functions.

Searching stackoverflow for both tags gives no single answer, and so I decided to ask, even if I already solved the puzzle, so people will have a hit in case of search.

I will let this question here, as people can suggest simple workarounds, and we may learn a bit more about the subject, but I'll use it to register my own answer after some (hard) efforts. Thanks.


To explain where I did start:

My first (almost) successful approach worked fine in a program that used both C and PROLOG.

It almost worked because latter on I saw this approach would not work in a PROLOG only project.

Anyway, what I did was simply add this

INPUT = README.md groups.dox c-and-pl.c c-and-pl.pl
FILE_PATTERNS = *.pl
EXTENSION_MAPPING += pl=c
EXTRACT_ALL = YES
EXTRACT_STATIC = YES
SOURCE_BROWSER = YES

And PROLOG code would look like:

/**
 * @file cpl.pl
 * @ingroup GroupUnique
 * @brief CPL - C calls Prolog (Prolog module)
 * @cond SKIPPROLOG
 */

 /* brief explanation in a normal (non-doxygen) comment */
 clause(A) :- 
     rule(X),
     test(A, X).

 and(so, on).

 /** @endcond */

This would work because C would create the site anyway, and PROLOG page would be just a brief, no clauses, but a link to see the complete code, with normal comments explaining the clauses.

Why this doesn't work for a pure PROLOG project? And how to do that?

Aucun commentaire:

Enregistrer un commentaire