Doyxgen onetime macro expansion / expansion command

105 Views Asked by At

I have some code like the following example:

/** @file HelloPi.c */

/** The definition of pi */
#define PI 3.1415

/** @brief The main function.
 *  @details Prints the value of #PI, which is actual defined as 3.1415. */
void main()
{
  printf("The value of pi is %f\n",PI);
}

In my doxygen dokumentation I would like to to have NO macro expansion for PI (and other defines) in general. But on one paragraph in the documentation I need the value of pi (e.g. @details description of the main function).

Is there any possibility to expand the macro at this single part of documentation with a command or something? Something like /** @details ...the value of #PI is $(PI).*/

I only know the build-in MACRO_EXPANSION tag which works for the whole documentation: https://www.doxygen.nl/manual/preprocessing.html :-/

Thanks for help :)
Jan

Edit: Add an other example which maybe better describes my Problem:

/** @file ErrorHandling.c */


#define ERR_CODE_POWERUNIT 1001 ///< Error in power unit */
            /** @page errors
             *  [value of ERR_CODE_POWERUNIT ] means \copybrief ERR_CODE_POWERUNIT */

void errHandler(int error)
{
  if(error=ERR_CODE_POWERUNIT)
    printf("Error %d occur\n",ERR_CODE_POWERUNIT);
}

In the documentation I would like to have: "1001 means Error in power unit"

1

There are 1 best solutions below

6
On BEST ANSWER

In doxygen there is no possibility to do a conversion of a predefined variable (only) in the documentation. You used in your documentation the an environment variable $(PI) but ths is quite cumbersome as you have to st the environment variable each time.

A better solution would be to use an ALIASES like:

ALIASES += pi=3.1415

or

ALIASES +\= "The value of PI = 3.14159265359..."

with which you define a command \pi that can be used in the documentation and will be replaced with the text / commands in the alias.

/** @details ...the value of #PI is \pi.*/

would result in something like (by head:

  ...the value of #PI is 3.1415