@@ -66,6 +66,9 @@ typedef yyguts_t *yyscan_t;
6666#include " trace.h"
6767#include " debug.h"
6868#include " stringutil.h"
69+ #include " config.h"
70+ #include " configimpl.h"
71+ #include " configoptions.h"
6972
7073// forward declarations
7174static bool handleBrief (yyscan_t yyscanner,const QCString &, const StringVector &);
@@ -620,6 +623,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
620623MODULE_ID ({ID}" ." )*{ID}
621624LINENR {Bopt}[1 -9 ][0 -9 ]*
622625IFILELINE (" \\ ifile \" " [^" ]*" \" \\ iline " [0 -9 ]+" " (" iprefix \" " [^" ]*" \" " )?(" iraise " [0 -9 ]+" " )?)
626+ DOXYCFG [A-Z][A-Z_0-9]*
623627
624628 // C start comment
625629CCS "/\*"
@@ -2391,7 +2395,7 @@ STopt [^\n@\\]*
23912395 unput (*yytext);
23922396 BEGIN (GuardParam);
23932397 }
2394- <GuardParam>{B}*[a-z_A-Z0-9 .\-]+ { // parameter of if/ifnot yyextra->guards
2398+ <GuardParam>{B}*[a-z_A-Z0-9 .\-]+({CMD} " doxyconfig " {B}+{DOXYCFG})? { // parameter of if/ifnot yyextra->guards
23952399 handleGuard (yyscanner,yytext);
23962400 }
23972401<GuardParam>{DOCNL} { // end of argument
@@ -4935,7 +4939,105 @@ static void handleGuard(yyscan_t yyscanner,const QCString &expr)
49354939 bool sectionEnabled = false ;
49364940 if (!expr.isEmpty())
49374941 {
4938- sectionEnabled=prs.parse (yyextra->fileName ,yyextra->lineNr ,expr.stripWhiteSpace ());
4942+ if (expr.contains (" @doxyconfig" ) || expr.contains (" \\ doxyconfig" ))
4943+ {
4944+ GrowBuf growBuf;
4945+ signed char c = 0 ;
4946+ const char *p=expr.data ();
4947+ size_t len = expr.length ();
4948+ while ((c=*p++)!=0 )
4949+ {
4950+ switch (c)
4951+ {
4952+ case ' \\ ' :
4953+ case ' @' :
4954+ if (*p == ' d' && QCString (p).startsWith (" doxyconfig" ))
4955+ {
4956+ p+=10 ; // skip doxyconfig
4957+ while (*p==' ' || *p==' \t ' ) {p++;}
4958+ GrowBuf growBufConfig;
4959+ while ((c=*p++)!=0 )
4960+ {
4961+ if ((c>=' A' && c<=' Z' ) || (c>=' 0' && c<=' 9' ) || c==' _' ) growBufConfig.addChar (c);
4962+ else
4963+ {
4964+ break ;
4965+ }
4966+ }
4967+ p--;
4968+ if (!growBufConfig.empty ())
4969+ {
4970+ growBufConfig.addChar (0 );
4971+ ConfigOption * opt = ConfigImpl::instance ()->get (growBufConfig.get ());
4972+ if (opt)
4973+ {
4974+ switch (opt->kind ())
4975+ {
4976+ case ConfigOption::O_Bool:
4977+ // In case the value is not in the settings the default is not usedin valueStringRef,
4978+ // but the user expects here the value used and not the settings value
4979+ // growBuf.addStr(*(static_cast<ConfigBool*>(opt)->valueStringRef()));
4980+ growBuf.addStr (*(static_cast <ConfigBool*>(opt)->valueRef ())? " YES" : " NO" );
4981+ break ;
4982+ case ConfigOption::O_String:
4983+ // due to the fact that there can be any character in the string
4984+ warn (yyextra->fileName ,yyextra->lineNr ,
4985+ " String setting '{}' not possible in conditional statement, ignored" , growBufConfig.get ());
4986+ break ;
4987+ case ConfigOption::O_Enum:
4988+ growBuf.addStr (*(static_cast <ConfigEnum*>(opt)->valueRef ()));
4989+ break ;
4990+ case ConfigOption::O_Int:
4991+ // In case the value is not in the settings the default is not usedin valueStringRef,
4992+ // but the user expects here the value used and not the settings value
4993+ // growBuf.addStr(*(static_cast<ConfigInt*>(opt)->valueStringRef()));
4994+ growBuf.addStr (QCString ().setNum (*(static_cast <ConfigInt*>(opt)->valueRef ())));
4995+ break ;
4996+ case ConfigOption::O_List:
4997+ warn (yyextra->fileName ,yyextra->lineNr ,
4998+ " List setting '{}' not possible in conditional statement, ignored" , growBufConfig.get ());
4999+ break ;
5000+ case ConfigOption::O_Obsolete:
5001+ warn (yyextra->fileName ,yyextra->lineNr ,
5002+ " Obsolete setting '{}' not possible in conditional statement, ignored" , growBufConfig.get ());
5003+ break ;
5004+ case ConfigOption::O_Disabled:
5005+ warn (yyextra->fileName ,yyextra->lineNr ,
5006+ " Disabled setting '{}' not possible in conditional statement, ignored" , growBufConfig.get ());
5007+ break ;
5008+ case ConfigOption::O_Info:
5009+ warn (yyextra->fileName ,yyextra->lineNr ,
5010+ " Info setting '{}' not possible in conditional statement, ignored" , growBufConfig.get ());
5011+ break ;
5012+ }
5013+ }
5014+ else
5015+ {
5016+ warn (yyextra->fileName ,yyextra->lineNr ,
5017+ " Unknown setting '{}' not possible in conditional statement, ignored" , growBufConfig.get ());
5018+ }
5019+ }
5020+ }
5021+ else
5022+ {
5023+ growBuf.addChar (c);
5024+ }
5025+ break ;
5026+ default :
5027+ growBuf.addChar (c);
5028+ break ;
5029+ }
5030+ }
5031+ if (!growBuf.empty ())
5032+ {
5033+ growBuf.addChar (0 );
5034+ sectionEnabled=prs.parse (yyextra->fileName ,yyextra->lineNr ,QCString (growBuf.get ()).stripWhiteSpace ());
5035+ }
5036+ }
5037+ else
5038+ {
5039+ sectionEnabled=prs.parse (yyextra->fileName ,yyextra->lineNr ,expr.stripWhiteSpace ());
5040+ }
49395041 }
49405042 bool parentEnabled = yyextra->guards->top ().parentVisible();
49415043 if (parentEnabled)
0 commit comments