doxygen nested \if \endif sample not working - doxygen

The nested if/endif sample seems not to work as expected:
http://www.doxygen.nl/manual/commands.html#cmdif
It produces:
Unconditionally shown documentation. More text. Unconditional text.
But I would expect:
Unconditionally shown documentation. Unconditional text.
I tried several doxygen versions (also the currently latest v1.8.6).
Does this sample work for anybody?
As a workaround I used:
/*! Unconditionally shown documentation.
* \if Cond1
* Only included if Cond1 is set.
* \endif
* \if Cond2
* Only included if Cond2 is set.
* \endif
* \if (Cond2 && Cond3)
* Only included if Cond2 and Cond3 are set.
* \endif
* \if Cond2
* More text.
* \endif
* Unconditional text.
*/
But I would prefer to use the nested style from the original sample.

I agree that the example should have worked, but apparently it never did and you are the first to notice!
Please file a bug report for this in the bug tracker here: https://bugzilla.gnome.org/enter_bug.cgi?product=doxygen

Related

Doxygen documentation of Fortran77 code (no line breaks, parameters not documented)

I want to write a comment before a Fortran77 routine (main or another subroutine), where the Doxygen (version 1.9.0) comment lines should appear in the Doxygen HTML documentation as in the source code (here four lines, with line breaks).
The documentation of the parameter TOTAL should also be displayed.
Can you reproduce that? What is the exact way to use Doxygen for this example?
Example (test.f):
!> header of doxygen documentation
!! first line of doxygen documentation
!! third line of doxygen documentation
!! #param AVRAGE information about the average
PROGRAM CH0502
C> THIS PROGRAM READS IN THREE NUMBERS AND SUMS
C> AND AVERAGES THEM.
C
IMPLICIT LOGICAL (A-Z)
REAL NUMBR1,NUMBR2,NUMBR3,AVRAGE,TOTAL
C
INTEGER N
N = 3
TOTAL = 0.0
PRINT *,'TYPE IN THREE NUMBERS'
PRINT *,'SEPARATED BY SPACES OR COMMAS'
READ *,NUMBR1,NUMBR2,NUMBR3
TOTAL= NUMBR1+NUMBR2+NUMBR3 !> #param TOTAL is the total
AVRAGE=TOTAL/N
PRINT *,'TOTAL OF NUMBERS IS',
PRINT *,'AVERAGE OF THE NUMBERS IS',AVRAGE
END
doxygen -x Doxyfile gives as output:
# Difference with default Doxyfile 1.9.0 (71777ff3973331bd9453870593a762e184ba9f78)
PROJECT_NAME = "Fortran project"
OUTPUT_DIRECTORY = C:\Users\me\Desktop\doxygen_fortran_documentation
OPTIMIZE_FOR_FORTRAN = YES
EXTRACT_ALL = YES
INPUT = C:\Users\me\Desktop\doxygen_fortran
RECURSIVE = YES
GENERATE_TREEVIEW = YES
GENERATE_LATEX = NO
CLASS_DIAGRAMS = NO
The documentation result looks different as expected.
As a comment cannot include images or layouted text I have to revert to an answer (well it partly is).
When I understand it correctly you would like to have something like:
is this correct?
This can be accomplished in a number of ways.
by means of adding \n at the end of each line
by means of adding <br> at the end of each line
So the source code will look like:
!> header of doxygen documentation\n
!! first line of doxygen documentation\n
!! third line of doxygen documentation\n
!! #param AVRAGE information about the average
PROGRAM CH0502

How to use \addtogroup with an ALIASES command?

I'm trying to create a custom command for easier group handling. The idea is in general...
ALIASES += opengroup{1}="^^* \addtogroup \1_GROUP ^^ * \{ ^^"
ALIASES += close="\}"
...to use in code file as...
/** \opengroup{LEVEL_1} */
// ...code statements...
/** \close */ // opengroup
...to get the doxygen result comment:
/**
* \addtogroup LEVEL_1_GROUP
* \{
*/
// ...code statements...
/** \} */ // opengroup
I tried with Doxygen 1.8.14. Unfortunately, this doesn't work. Any ideas?
Edit:
I think the root problem is the \addtogroup command with its syntax. My hope was to clear this with inserting '^^' to force a new line, but it seems to me doxygen is parsing the command in one line instead of resolving the '^^' new line in a pre-step...
A bit weird. With the alias:
ALIASES += opengroup{1}="^^* \addtogroup \1_GROUP ^^ * \\{ ^^"
so with a double backslash (\\) before the curly bracket open ({) I got it working.
I also get it working with:
ALIASES += opengroup{1}="^^* \addtogroup \1_GROUP ^^ * #{ ^^"
so it looks like the extra backslash is eaten at an unexpected place. The \ and # should be synonyms, but as \ is also an escape character so it is quite often tricky.
Note:
I used doxygen -d commentscan to see the replacement
Might change in the future as I think this might be a bug.
Problem is caused due to the fact that ALIASES can be nested and after a change the new string is seen as input. When needing a literal {, } or , in the expanded output one has to escape them with a \ and the \ is removed at the en. Problem here arises with the commands \{ and \} as here the \ serves as 'command indicator'. Best to use #{ and #} in case the 'block commands' are needed. the \} in \close doesn't have the problem as it is not re-evaluated.

Drools viable input error

I used SpreadsheetCompiler to extract the drl for my Decision Table. Here is the relevant bit
global Integer netincome;
// rule values at C14, header at C8
rule "Net Income_14"
salience 65522
when
user:CSUserBundle(user.grossHouseholdIncome >= 0, user.grossHouseholdIncome < 1150000, user.grossHouseholdIncome >= 15700*52, user.grossHouseholdIncome < 86600*52)
then
netincome = eval(user.grossHouseholdIncome - 0 - (user.grossHouseholdIncome – 816400) * 0.12 - 0)
end
My error is:
E 14:35:30:235 : main : org.drools.compiler.kie.builder.impl.AbstractKieModule : Unable to build KieBaseModel:defaultKieBase
[11,78]: [ERR 101] Line 11:78 no viable alternative at input ''
Unfortunately the column number 78, is in the error is the middle of the 2nd user.grossHouseholdIncome in the 'then' statement. I searched thru the documentation but could not find anything about using a variable name twice in the text. I tried adding the 'eval' in response to De Smet's suggestion for the same error. Any ideas?
What I did was to copy-paste the rule into a decent text editor and then try to search for all occurrences of special ASCII characters like quote (") or hyphen (-) or anything else the marvellous office programs are apt to convert into some Unicode glyph that sure is looking good but rejected by compilers. Also, do not trust spaces. Frequently they are optical illusions created by a program due to some TAB character. I have replaced the spaces by a single underscore
to represent a TAB. And now the 78 aligns exactly with the evil character.
_netincome = eval(user.grossHouseholdIncome - 0 - (user.grossHouseholdIncome – 816400) * 0.12 - 0)
....5...10....5...20....5...30....5...40....5...50....5...60....5...70....5...80

Doxygen breaks my code inside pre-tag

If I have a part of comment code in <pre> block, Doxygen will broke it.
For example:
/*
* Find biggest letter one can send by some amount of money
* #param money how much money on has
* #return weight of biggest letter on can send by that amount of money
* <pre name="test">
* biggestLetter($money) ~~~ $weight;
*
* $money | $weight
* -------------------
* 10.00 | 2000
* 3.40 | 500
* 0.50 | 0
* </pre>
*/
If there is odd number of ~~~ combinations, the document
will not papper at all
if there is blank lines inside the block, it will forget the
pre-block
the ------ -line will make the previous line as a header
I know all these problems comes from Markdown support. But even
disabling the markdown support does not help problem 2.
And actually I do not want to disable markdown support.
So how to tell Doxygen not to touch my code inside <pre> block,
so outputting it to document exactly how I have written it?

lex - Removing "/*" also removes internal stars

I'm trying to pull comments out of a c file. But my code pulls out all stars instead of just /* and */. Can anyone help?
Input /**A**/ or /***/
Desired Output *A* and *
My Output *A and nothing
Code
"/*" /* comment */ BEGIN(Comment);
<Comment>{
[^*] /* not a '*' */ ECHO;
"*"+[^/] /* '*'s not followed by '/' */ ECHO;
"*"+"/" /* end of Comment */ BEGIN(INITIAL);
}
Change your last two patterns to
"*"+/[^/]
"*/"
Your last pattern explicitly takes every * at the end of the comment out of the comment. If you only change the last rule, then it will not recognize the end of the comment of for example /***/, because /* will start the comment, then ** is matched by the one but last pattern and the / is matched by [^*].
"*"+/[^/] matches all sequences of * followed by anything but a /, but not consuming the character that follows. This is necessary as this could be the * of the */ closing the comment.
This regex matches non-nesting C comments:
"/*"([^*]|[*]*[^*/])*"*"+"/"
Here is a complete Lex program which strips C comments from input, replacing each one with a space.
%%
"/*"([^*]|[*]*[^*/])*"*"+"/" putc(' ', yyout);
%%
However, this fails to provide helpful diagnostics. For instance if something like /* /* */ occurs, it's nice to generate a warning about a suspicious looking start of a comment within a comment. Also, if a comment is unterminated, it's useful to detect that and produce a diagnostic about were that diagnostic started.
For these reasons, it may be best to handle C comments by recognizing just the /* sequence and then taking over with a custom piece of code that reads characters from the yyin stream and recognizes the rest of the comment.