Commit ef99315d authored by dimitri's avatar dimitri

Release-1.2.0-20000806

parent e139c024
DOXYGEN Version 1.2.0-20000731 DOXYGEN Version 1.2.0-20000806
Please read the installation section of the manual for instructions. Please read the installation section of the manual for instructions.
-------- --------
Dimitri van Heesch (31 July 2000) Dimitri van Heesch (06 August 2000)
DOXYGEN Version 1.2.0-20000731 DOXYGEN Version 1.2.0-20000806
Please read INSTALL for compilation instructions. Please read INSTALL for compilation instructions.
...@@ -7,4 +7,4 @@ The latest version of doxygen can be obtained at ...@@ -7,4 +7,4 @@ The latest version of doxygen can be obtained at
Enjoy, Enjoy,
Dimitri van Heesch (31 July 2000) Dimitri van Heesch (06 August 2000)
1.2.0-20000731 1.2.0-20000806
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <qstrlist.h> #include <qstrlist.h>
#include <qfile.h> #include <qfile.h>
extern void parseConfig(const QCString &config); extern void parseConfig(const QCString &config,const char *fn);
extern void writeTemplateConfig(QFile *f,bool shortList); extern void writeTemplateConfig(QFile *f,bool shortList);
extern void checkConfig(); extern void checkConfig();
extern void configStrToVal(); extern void configStrToVal();
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <qdir.h> #include <qdir.h>
#include <qtextstream.h> #include <qtextstream.h>
#include <qregexp.h> #include <qregexp.h>
#include <qstack.h>
#include "config.h" #include "config.h"
#include "version.h" #include "version.h"
...@@ -58,6 +59,7 @@ void initWarningFormat() ...@@ -58,6 +59,7 @@ void initWarningFormat()
#include "language.h" #include "language.h"
#endif #endif
#define MAX_INCLUDE_DEPTH 10
#define YY_NEVER_INTERACTIVE 1 #define YY_NEVER_INTERACTIVE 1
#define YY_NO_UNPUT #define YY_NO_UNPUT
...@@ -72,16 +74,31 @@ void initWarningFormat() ...@@ -72,16 +74,31 @@ void initWarningFormat()
* *
* static variables * static variables
*/ */
static const char * inputString; struct ConfigFileState
static int inputPosition; {
static int yyLineNr; int lineNr;
static QCString tmpString; FILE *filePtr;
static QCString * s=0; YY_BUFFER_STATE oldState;
static bool * b=0; YY_BUFFER_STATE newState;
static QStrList * l=0; QCString fileName;
static int lastState; };
static QCString elemStr;
static const char *inputString;
static int inputPosition;
static int yyLineNr;
static QCString yyFileName;
static QCString tmpString;
static QCString *s=0;
static bool *b=0;
static QStrList *l=0;
static int lastState;
static QCString elemStr;
static QCString includeName;
static QStrList includePathList;
static QStack<ConfigFileState> includeStack;
static int includeDepth;
#CONFIG Static #CONFIG Static
/* ----------------------------------------------------------------- /* -----------------------------------------------------------------
...@@ -91,15 +108,100 @@ static QCString elemStr; ...@@ -91,15 +108,100 @@ static QCString elemStr;
static int yyread(char *buf,int max_size) static int yyread(char *buf,int max_size)
{ {
int c=0; // no file included
while( c < max_size && inputString[inputPosition] ) if (includeStack.isEmpty())
{ {
*buf = inputString[inputPosition++] ; int c=0;
c++; buf++; while( c < max_size && inputString[inputPosition] )
{
*buf = inputString[inputPosition++] ;
c++; buf++;
}
return c;
}
else
{
//assert(includeStack.current()->newState==YY_CURRENT_BUFFER);
return fread(buf,1,max_size,includeStack.current()->filePtr);
} }
return c;
} }
static FILE *tryPath(const char *path,const char *fileName)
{
QCString absName=(QCString)path+"/"+fileName;
QFileInfo fi(absName);
if (fi.exists() && fi.isFile())
{
FILE *f=fopen(absName,"r");
if (!f) err("Error: could not open file %s for reading\n",absName.data());
return f;
}
return 0;
}
static FILE *findFile(const char *fileName)
{
char *s=includePathList.first();
while (s) // try each of the include paths
{
FILE *f = tryPath(s,fileName);
if (f) return f;
s=includePathList.next();
}
// try cwd if includePathList fails
return tryPath(".",fileName);
}
static void readIncludeFile(const char *incName)
{
if (includeDepth==MAX_INCLUDE_DEPTH) {
err("Error: maximum include depth (%d) reached, %s is not included. Aborting...\n",
MAX_INCLUDE_DEPTH,incName);
exit(1);
}
QCString inc = incName;
inc = inc.stripWhiteSpace();
uint incLen = inc.length();
if (inc.at(0)=='"' && inc.at(incLen-1)=='"') // strip quotes
{
inc=inc.mid(1,incLen-2);
}
FILE *f;
//printf("Searching for `%s'\n",incFileName.data());
if ((f=findFile(inc))) // see if the include file can be found
{
// For debugging
#if SHOW_INCLUDES
for (i=0;i<includeStack.count();i++) msg(" ");
msg("@INCLUDE = %s: parsing...\n",inc.data());
#endif
// store the state of the old file
ConfigFileState *fs=new ConfigFileState;
fs->oldState=YY_CURRENT_BUFFER;
fs->lineNr=yyLineNr;
fs->fileName=yyFileName;
fs->filePtr=f;
// push the state on the stack
includeStack.push(fs);
// set the scanner to the include file
yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE));
fs->newState=YY_CURRENT_BUFFER;
yyFileName=inc;
includeDepth++;
}
else
{
err("Error: @INCLUDE = %s: not found!\n",inc.data());
exit(1);
}
}
%} %}
%option noyywrap %option noyywrap
...@@ -111,13 +213,44 @@ static int yyread(char *buf,int max_size) ...@@ -111,13 +213,44 @@ static int yyread(char *buf,int max_size)
%x GetStrList %x GetStrList
%x GetQuotedString %x GetQuotedString
%x GetEnvVar %x GetEnvVar
%x Include
%% %%
<*>\0x0d <*>\0x0d
<Start,GetString,GetStrList,GetBool>"#" { BEGIN(SkipComment); } <Start,GetString,GetStrList,GetBool>"#" { BEGIN(SkipComment); }
#CONFIG Rules #CONFIG Rules
<Start>[a-z_A-Z0-9]+ { err("Warning: ignoring unknown tag `%s' at line %d\n",yytext,yyLineNr); }
<Start>"@INCLUDE_PATH"[ \t]*"=" { BEGIN(GetStrList); l=&includePathList; l->clear(); elemStr=""; }
/* include a config file */
<Start>"@INCLUDE"[ \t]*"=" { BEGIN(Include);}
<Include>([^ \"\t\r\n]+)|("\""[^\n\"]+"\"") {
readIncludeFile(yytext);
BEGIN(Start);
}
<<EOF>> {
//printf("End of include file\n");
//printf("Include stack depth=%d\n",g_includeStack.count());
if (includeStack.isEmpty())
{
//printf("Terminating scanner!\n");
yyterminate();
}
else
{
ConfigFileState *fs=includeStack.pop();
pclose(fs->filePtr);
YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
yy_switch_to_buffer( fs->oldState );
yy_delete_buffer( oldBuf );
yyLineNr=fs->lineNr;
yyFileName=fs->fileName;
delete fs; fs=0;
includeDepth--;
}
}
<Start>[a-z_A-Z0-9]+ { err("Warning: ignoring unknown tag `%s' at line %d, file %s\n",yytext,yyLineNr,yyFileName.data()); }
<GetString,GetBool>\n { yyLineNr++; BEGIN(Start); } <GetString,GetBool>\n { yyLineNr++; BEGIN(Start); }
<GetStrList>\n { <GetStrList>\n {
yyLineNr++; yyLineNr++;
...@@ -141,22 +274,6 @@ static int yyread(char *buf,int max_size) ...@@ -141,22 +274,6 @@ static int yyread(char *buf,int max_size)
BEGIN(GetQuotedString); BEGIN(GetQuotedString);
tmpString.resize(0); tmpString.resize(0);
} }
/*
<GetString,GetStrList,GetQuotedString>"\$\(" {
//printf(">> Enter env\n");
lastEnvState=YY_START;
BEGIN(GetEnvVar);
}
<GetEnvVar>[a-z_A-Z0-9]+")" {
yytext[yyleng-1]='\0';
const char *env=getenv(yytext);
int i;
int l=strlen(env);
//printf("env name=`%s' text=`%s'\n",yytext,env);
for (i=l-1;i>=0;i--) unput(env[i]);
BEGIN(lastEnvState);
}
*/
<GetQuotedString>"\""|"\n" { <GetQuotedString>"\""|"\n" {
//printf("Quoted String = `%s'\n",tmpString.data()); //printf("Quoted String = `%s'\n",tmpString.data());
if (lastState==GetString) if (lastState==GetString)
...@@ -165,7 +282,7 @@ static int yyread(char *buf,int max_size) ...@@ -165,7 +282,7 @@ static int yyread(char *buf,int max_size)
elemStr+=tmpString; elemStr+=tmpString;
if (*yytext=='\n') if (*yytext=='\n')
{ {
err("Warning: Missing end quote (\") on line %d\n",yyLineNr); err("Warning: Missing end quote (\") on line %d, file %s\n",yyLineNr,yyFileName.data());
yyLineNr++; yyLineNr++;
} }
BEGIN(lastState); BEGIN(lastState);
...@@ -185,8 +302,8 @@ static int yyread(char *buf,int max_size) ...@@ -185,8 +302,8 @@ static int yyread(char *buf,int max_size)
{ {
*b=FALSE; *b=FALSE;
warn_cont("Warning: Invalid value `%s' for " warn_cont("Warning: Invalid value `%s' for "
"boolean tag in line %d; use YES or NO\n", "boolean tag in line %d, file %s; use YES or NO\n",
bs.data(),yyLineNr); bs.data(),yyLineNr,yyFileName.data());
} }
} }
<GetStrList>[^ \#\"\t\r\n]+ { <GetStrList>[^ \#\"\t\r\n]+ {
...@@ -249,7 +366,7 @@ static void writeStringList(QTextStream &t,QStrList &l) ...@@ -249,7 +366,7 @@ static void writeStringList(QTextStream &t,QStrList &l)
const char *s=p; const char *s=p;
bool hasBlanks=FALSE; bool hasBlanks=FALSE;
while ((c=*p++)!=0 && !hasBlanks) hasBlanks = (c==' ' || c=='\n' || c=='\t'); while ((c=*p++)!=0 && !hasBlanks) hasBlanks = (c==' ' || c=='\n' || c=='\t');
if (!first) t << " "; if (!first) t << " ";
first=FALSE; first=FALSE;
if (hasBlanks) t << "\"" << s << "\""; else t << s; if (hasBlanks) t << "\"" << s << "\""; else t << s;
p = l.next(); p = l.next();
...@@ -378,7 +495,7 @@ static void substEnvVarsInString(QCString &s) ...@@ -378,7 +495,7 @@ static void substEnvVarsInString(QCString &s)
QCString env=getenv(s.mid(i+2,l-3)); QCString env=getenv(s.mid(i+2,l-3));
substEnvVarsInString(env); // recursively expand variables if needed. substEnvVarsInString(env); // recursively expand variables if needed.
s = s.left(i)+env+s.right(s.length()-i-l); s = s.left(i)+env+s.right(s.length()-i-l);
p=i+l; p=i+env.length(); // next time start at the end of the expanded string
} }
//printf("substEnvVarInString(%s) end\n",s.data()); //printf("substEnvVarInString(%s) end\n",s.data());
} }
...@@ -866,11 +983,15 @@ void checkConfig() ...@@ -866,11 +983,15 @@ void checkConfig()
} }
void parseConfig(const QCString &s) void parseConfig(const QCString &s,const char *fn)
{ {
inputString = s; inputString = s;
inputPosition = 0; inputPosition = 0;
yyLineNr = 1; yyLineNr = 1;
yyFileName=fn;
includeStack.setAutoDelete(TRUE);
includeStack.clear();
includeDepth = 0;
configYYrestart( configYYin ); configYYrestart( configYYin );
BEGIN( Start ); BEGIN( Start );
configYYlex(); configYYlex();
......
...@@ -78,7 +78,7 @@ static bool loadConfig( QString loadFile ) ...@@ -78,7 +78,7 @@ static bool loadConfig( QString loadFile )
// parse the config file // parse the config file
// this will initialize the various Config data members // this will initialize the various Config data members
parseConfig(contents); parseConfig(contents,loadFile);
configStrToVal(); configStrToVal();
f.close(); f.close();
......
...@@ -909,7 +909,7 @@ Public/Protected/Private/... section. ...@@ -909,7 +909,7 @@ Public/Protected/Private/... section.
\sa section \ref cmdlink "\\link". \sa section \ref cmdlink "\\link".
<hr> <hr>
\subsection cmdlink \link <link-object> \subsection cmdlink \link <link-object>
\addindex \link \addindex \link
The links that are automatically generated by Doxygen always have the The links that are automatically generated by Doxygen always have the
...@@ -924,10 +924,6 @@ Public/Protected/Private/... section. ...@@ -924,10 +924,6 @@ Public/Protected/Private/... section.
See section \ref autolink "autolink" for more information on automatically See section \ref autolink "autolink" for more information on automatically
generated links and valid link-objects. generated links and valid link-objects.
\b Note:
Keep in mind that links are only meaningful in HTML text;
in \f$\mbox{\LaTeX}\f$ text, the link text is just written to the output.
<hr> <hr>
\subsection cmdref \ref <name> ["(text)"] \subsection cmdref \ref <name> ["(text)"]
...@@ -1315,7 +1311,7 @@ Public/Protected/Private/... section. ...@@ -1315,7 +1311,7 @@ Public/Protected/Private/... section.
\ref cmdlatexonly "\\latexonly". \ref cmdlatexonly "\\latexonly".
<hr> <hr>
\subsection cmdimage \image <format> <file> [<sizeindication>=<size>] \subsection cmdimage \image <format> <file> ["<caption>"] [<sizeindication>=<size>]
\addindex \image \addindex \image
Inserts an image into the documentation. This command is format Inserts an image into the documentation. This command is format
...@@ -1327,27 +1323,36 @@ Public/Protected/Private/... section. ...@@ -1327,27 +1323,36 @@ Public/Protected/Private/... section.
The second argument specifies the file name of the image. The second argument specifies the file name of the image.
Doxygen will look for files in the paths (or files) that you specified Doxygen will look for files in the paths (or files) that you specified
after the \ref cfg_image_path "IMAGE_PATH" tag. after the \ref cfg_image_path "IMAGE_PATH" tag.
If the image is found it will be copied to the correct output directory. If the image is found it will be copied to the correct output directory.
If the image name contains spaces you'll have to put quotes (") around it. If the image name contains spaces you'll have to put quotes (") around it.
You can also specify an absolute URL instead of a file name, but then
The third argument can be used to specify the width or height of the doxygen does not copy the image or check its existance.
image. This is only useful for \f$\mbox{\LaTeX}\f$ output
(i.e. format=latex). \c sizeindication can be either The third argument is optional and can be used to specify the caption
\c width or \c height. The size should be a valid that is displayed below the image. This argument has to be specified
between quotes even if it does not contain any spaces. The quotes are
stripped before the caption is displayed.
The fourth argument is also optional and can be used to specify the
width or height of the image. This is only useful
for \f$\mbox{\LaTeX}\f$ output
(i.e. format=<code>latex</code>). The \c sizeindication can be
either \c width or \c height. The size should be a valid
size specifier in \f$\mbox{\LaTeX}\f$ (for example <code>10cm</code> or size specifier in \f$\mbox{\LaTeX}\f$ (for example <code>10cm</code> or
<code>6in</code>). <code>6in</code> or a symbolic width like <code>\\textwidth</code>).
Here is example of a comment block: Here is example of a comment block:
\verbatim \verbatim
/*! Here is a snapshot of my new application: /*! Here is a snapshot of my new application:
* \image html application.jpg * \image html application.jpg
* \image latex application.eps width=10cm * \image latex application.eps "My application" width=10cm
*/ */
\endverbatim \endverbatim
And this is an example of how the configuration file may look: And this is an example of how the relevant part of the configuration file
may look:
\verbatim \verbatim
IMAGE_PATH = my_image_dir IMAGE_PATH = my_image_dir
......
...@@ -40,6 +40,19 @@ Multiple lines can be concatenated by inserting a backslash (\\) ...@@ -40,6 +40,19 @@ Multiple lines can be concatenated by inserting a backslash (\\)
as the last character of a line. Environment variables can be expanded as the last character of a line. Environment variables can be expanded
using the pattern \c $(ENV_VARIABLE_NAME). using the pattern \c $(ENV_VARIABLE_NAME).
You can also include part of a configuration file from another configuration
file using a <code>\@INCLUDE</code> tag as follows:
\verbatim
@INCLUDE = config_file_name
\endverbatim
The include file is searched in the current working directory. You can
also specify a list of directories that should be searched before looking
in the current working directory. Do this by putting a <code>\@INCLUDEPATH</code> tag
with these paths before the <code>\@INCLUDE</code> tag, e.g:
\verbatim
@INCLUDEPATH = my_config_dir
\endverbatim
The configuration options can be divided into several categories. The configuration options can be divided into several categories.
Below is an alphabetical index of the tags that are recognized Below is an alphabetical index of the tags that are recognized
followed by the descriptions of the tags grouped by category. followed by the descriptions of the tags grouped by category.
......
...@@ -197,21 +197,22 @@ During parsing the following steps take place: ...@@ -197,21 +197,22 @@ During parsing the following steps take place:
See section \ref htmlcmds for an overview of all supported HTML tags. See section \ref htmlcmds for an overview of all supported HTML tags.
</ul> </ul>
Using a number of column-aligned minus signs at the start of a By putting a number of column-aligned minus signs at the start of a
line in a comment block will generate a bullet list. line, a bullet list will automatically be generated.
Nested lists are also possible. Numbered lists can also be generated by using a minus followed by a hash.
Nesting of lists is allowed.<p>
Here is an example: Here is an example:
\verbatim \verbatim
/*! /*!
* A list of events: * A list of events:
* - mouse events * - mouse events
* - mouse move event * -# mouse move event
* - mouse click event * -# mouse click event\n
* - mouse double click event\n * More info about the click event.
* More info about the click event. * -# mouse double click event
* - keyboard events * - keyboard events
* - key down event * -# key down event
* - key up event * -# key up event
* *
* More text here. * More text here.
*/ */
...@@ -220,13 +221,13 @@ Using a number of column-aligned minus signs at the start of a ...@@ -220,13 +221,13 @@ Using a number of column-aligned minus signs at the start of a
A list of events: A list of events:
- mouse events - mouse events
- mouse move event -# mouse move event
- mouse click event\n -# mouse click event\n
More info about the click event. More info about the click event.
- mouse double click event -# mouse double click event
- keyboard events - keyboard events
- key down event -# key down event
- key up event -# key up event
More text here. More text here.
......
Name: doxygen Name: doxygen
Version: 1.2.0-20000731 Version: 1.2.0-20000806
Summary: documentation system for C, C++ and IDL Summary: documentation system for C, C++ and IDL
Release: 1 Release: 1
Source0: doxygen-%{version}.src.tar.gz Source0: doxygen-%{version}.src.tar.gz
......
...@@ -39,7 +39,7 @@ clean: Makefile.doxygen Makefile.doxytag Makefile.doxysearch ...@@ -39,7 +39,7 @@ clean: Makefile.doxygen Makefile.doxytag Makefile.doxysearch
$(MAKE) -f Makefile.doxysearch clean $(MAKE) -f Makefile.doxysearch clean
distclean: clean distclean: clean
-$(RM) scanner.cpp code.cpp config.cpp pre.cpp ce_lex.cpp \ -$(RM) scanner.cpp doc.cpp code.cpp config.cpp pre.cpp ce_lex.cpp \
ce_parse.cpp ce_parse.h doxytag.cpp tag.cpp \ ce_parse.cpp ce_parse.h doxytag.cpp tag.cpp \
declinfo.cpp defargs.cpp declinfo.cpp defargs.cpp
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "classdef.h" #include "classdef.h"
#include "classlist.h" #include "classlist.h"
#include "entry.h" #include "entry.h"
#include "scanner.h" #include "doc.h"
#include "doxygen.h" #include "doxygen.h"
#include "membername.h" #include "membername.h"
#include "message.h" #include "message.h"
...@@ -974,7 +974,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ...@@ -974,7 +974,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trMemberTypedefDocumentation()); parseText(ol,theTranslator->trMemberTypedefDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
typedefMembers.writeDocumentation(ol,name()); typedefMembers.writeDocumentation(ol,name(),this);
} }
enumMembers.countDocMembers(); enumMembers.countDocMembers();
...@@ -984,7 +984,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ...@@ -984,7 +984,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trMemberEnumerationDocumentation()); parseText(ol,theTranslator->trMemberEnumerationDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
enumMembers.writeDocumentation(ol,name()); enumMembers.writeDocumentation(ol,name(),this);
} }
//enumValMembers.countDocMembers(); //enumValMembers.countDocMembers();
...@@ -1004,7 +1004,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ...@@ -1004,7 +1004,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trConstructorDocumentation()); parseText(ol,theTranslator->trConstructorDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
constructors.writeDocumentation(ol,name()); constructors.writeDocumentation(ol,name(),this);
} }
functionMembers.countDocMembers(); functionMembers.countDocMembers();
...@@ -1014,7 +1014,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ...@@ -1014,7 +1014,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trMemberFunctionDocumentation()); parseText(ol,theTranslator->trMemberFunctionDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
functionMembers.writeDocumentation(ol,name()); functionMembers.writeDocumentation(ol,name(),this);
} }
relatedMembers.countDocMembers(); relatedMembers.countDocMembers();
...@@ -1024,7 +1024,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ...@@ -1024,7 +1024,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trRelatedFunctionDocumentation()); parseText(ol,theTranslator->trRelatedFunctionDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
relatedMembers.writeDocumentation(ol,name()); relatedMembers.writeDocumentation(ol,name(),this);
} }
variableMembers.countDocMembers(); variableMembers.countDocMembers();
...@@ -1034,7 +1034,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ...@@ -1034,7 +1034,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trMemberDataDocumentation()); parseText(ol,theTranslator->trMemberDataDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
variableMembers.writeDocumentation(ol,name()); variableMembers.writeDocumentation(ol,name(),this);
} }
ol.startTextBlock(); ol.startTextBlock();
...@@ -1601,7 +1601,7 @@ void ClassDef::determineImplUsageRelation() ...@@ -1601,7 +1601,7 @@ void ClassDef::determineImplUsageRelation()
MemberDef *md=mi->memberDef; MemberDef *md=mi->memberDef;
if (md->isVariable()) // for each member variable in this class if (md->isVariable()) // for each member variable in this class
{ {
QCString type=md->typeString(); QCString type=removeRedundantWhiteSpace(md->typeString());
int typeLen=type.length(); int typeLen=type.length();
static const QRegExp re("[a-z_A-Z][a-z_A-Z0-9:]*"); static const QRegExp re("[a-z_A-Z][a-z_A-Z0-9:]*");
//printf("in class %s found var type=`%s' name=`%s'\n", //printf("in class %s found var type=`%s' name=`%s'\n",
......
...@@ -203,6 +203,7 @@ struct UsesClassDef ...@@ -203,6 +203,7 @@ struct UsesClassDef
UsesClassDef(ClassDef *cd) : classDef(cd) UsesClassDef(ClassDef *cd) : classDef(cd)
{ {
accessors = new QDict<void>(17); accessors = new QDict<void>(17);
containment = TRUE;
} }
~UsesClassDef() ~UsesClassDef()
{ {
...@@ -218,6 +219,7 @@ struct UsesClassDef ...@@ -218,6 +219,7 @@ struct UsesClassDef
ClassDef *classDef; ClassDef *classDef;
QDict<void> *accessors; QDict<void> *accessors;
QCString templSpecifiers; QCString templSpecifiers;
bool containment;
}; };
class UsesClassDict : public QDict<UsesClassDef> class UsesClassDict : public QDict<UsesClassDef>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "util.h" #include "util.h"
#include "outputlist.h" #include "outputlist.h"
#include "language.h" #include "language.h"
#include "scanner.h" #include "doc.h"
ClassList::ClassList() : QList<ClassDef>() ClassList::ClassList() : QList<ClassDef>()
{ {
......
...@@ -410,7 +410,7 @@ static bool getLink(const char *className, ...@@ -410,7 +410,7 @@ static bool getLink(const char *className,
FileDef *fd; FileDef *fd;
NamespaceDef *nd; NamespaceDef *nd;
GroupDef *gd; GroupDef *gd;
QCString m=memberName; QCString m=removeRedundantWhiteSpace(memberName);
QCString c=className; QCString c=className;
//printf("Trying `%s'::`%s'\n",c.data(),m.data()); //printf("Trying `%s'::`%s'\n",c.data(),m.data());
if (getDefs(c,m,"()",md,cd,fd,nd,gd) && md->isLinkable()) if (getDefs(c,m,"()",md,cd,fd,nd,gd) && md->isLinkable())
...@@ -574,39 +574,6 @@ static void generateMemberLink(OutputList &ol,const char *varName, ...@@ -574,39 +574,6 @@ static void generateMemberLink(OutputList &ol,const char *varName,
if (mcd && mcd->isLinkable()) if (mcd && mcd->isLinkable())
{ {
if (generateClassMemberLink(ol,mcd,memName)) return; if (generateClassMemberLink(ol,mcd,memName)) return;
#if 0
//printf("Found class `%s'\n",mcd->name().data());
MemberName *mmn=memberNameDict[memName];
if (mmn)
{
MemberNameIterator mmni(*mmn);
MemberDef *mmd,*xmd=0;
ClassDef *xcd=0;
const int maxInheritanceDepth = 100000;
int mdist=maxInheritanceDepth;
for (;(mmd=mmni.current());++mmni)
{
int m=minClassDistance(mcd,mmd->getClassDef());
if (m<mdist && mmd->getClassDef()->isLinkable())
{
mdist=m;
xcd=mmd->getClassDef();
xmd=mmd;
}
}
if (mdist!=maxInheritanceDepth)
{
if (g_currentDefinition && g_currentMemberDef &&
xmd!=g_currentMemberDef && g_insideBody)
{
xmd->addSourceReference(g_currentMemberDef);
}
writeMultiLineCodeLink(ol,xcd->getReference(),
xcd->getOutputFileBase(),xmd->anchor(),memName);
return;
}
}
#endif
} }
} }
} }
...@@ -617,27 +584,12 @@ static void generateMemberLink(OutputList &ol,const char *varName, ...@@ -617,27 +584,12 @@ static void generateMemberLink(OutputList &ol,const char *varName,
return; return;
} }
static QCString removeWhiteSpace(const char *s)
{
QCString result;
if (s)
{
const char *p=s;
int c;
while ((c=*p++))
{
if (c!=' ' && c!='\n' && c!='\r' && c!='\t') result+=c;
}
}
return result;
}
static void generateFunctionLink(OutputList &ol,char *funcName) static void generateFunctionLink(OutputList &ol,char *funcName)
{ {
OutputList result(&ol); OutputList result(&ol);
CodeClassDef *ccd=0; CodeClassDef *ccd=0;
QCString locScope=g_classScope.copy(); QCString locScope=g_classScope.copy();
QCString locFunc=removeWhiteSpace(funcName); QCString locFunc=removeRedundantWhiteSpace(funcName);
int i=locFunc.findRev("::"); int i=locFunc.findRev("::");
if (i>0) if (i>0)
{ {
...@@ -970,7 +922,7 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned" ...@@ -970,7 +922,7 @@ TYPEKW ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned"
addType(); addType();
g_name+=yytext; g_name+=yytext;
} }
<Body>{SCOPENAME}{B}*"<"[^\n\>]*">"/{B}* { // A<T> *pt; <Body>{SCOPENAME}{B}*"<"[^\n\"\>]*">"/{B}* { // A<T> *pt;
generateClassLink(*g_code,yytext); generateClassLink(*g_code,yytext);
addType(); addType();
g_name+=yytext; g_name+=yytext;
......
/* This file was generated by configgen on Mon Jul 31 16:07:18 2000 /* This file was generated by configgen on Sat Aug 5 20:49:38 2000
* from config_templ.h * from config_templ.h
* *
* DO NOT EDIT! * DO NOT EDIT!
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <qstrlist.h> #include <qstrlist.h>
#include <qfile.h> #include <qfile.h>
extern void parseConfig(const QCString &config); extern void parseConfig(const QCString &config,const char *fn);
extern void writeTemplateConfig(QFile *f,bool shortList); extern void writeTemplateConfig(QFile *f,bool shortList);
extern void checkConfig(); extern void checkConfig();
extern void configStrToVal(); extern void configStrToVal();
......
/* This file was generated by configgen on Mon Jul 31 16:11:27 2000 /* This file was generated by configgen on Sun Aug 6 16:28:57 2000
* from config_templ.l * from config_templ.l
* *
* DO NOT EDIT! * DO NOT EDIT!
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <qdir.h> #include <qdir.h>
#include <qtextstream.h> #include <qtextstream.h>
#include <qregexp.h> #include <qregexp.h>
#include <qstack.h>
#include "config.h" #include "config.h"
#include "version.h" #include "version.h"
...@@ -64,6 +65,7 @@ void initWarningFormat() ...@@ -64,6 +65,7 @@ void initWarningFormat()
#include "language.h" #include "language.h"
#endif #endif
#define MAX_INCLUDE_DEPTH 10
#define YY_NEVER_INTERACTIVE 1 #define YY_NEVER_INTERACTIVE 1
#define YY_NO_UNPUT #define YY_NO_UNPUT
...@@ -178,16 +180,31 @@ QStrList Config::extDocPathList; ...@@ -178,16 +180,31 @@ QStrList Config::extDocPathList;
* *
* static variables * static variables
*/ */
static const char * inputString; struct ConfigFileState
static int inputPosition; {
static int yyLineNr; int lineNr;
static QCString tmpString; FILE *filePtr;
static QCString * s=0; YY_BUFFER_STATE oldState;
static bool * b=0; YY_BUFFER_STATE newState;
static QStrList * l=0; QCString fileName;
static int lastState; };
static QCString elemStr;
static const char *inputString;
static int inputPosition;
static int yyLineNr;
static QCString yyFileName;
static QCString tmpString;
static QCString *s=0;
static bool *b=0;
static QStrList *l=0;
static int lastState;
static QCString elemStr;
static QCString includeName;
static QStrList includePathList;
static QStack<ConfigFileState> includeStack;
static int includeDepth;
static QCString tabSizeString; static QCString tabSizeString;
static QCString colsInAlphaIndexString; static QCString colsInAlphaIndexString;
static QCString maxDotGraphWidthString; static QCString maxDotGraphWidthString;
...@@ -200,15 +217,100 @@ static QCString maxDotGraphHeightString; ...@@ -200,15 +217,100 @@ static QCString maxDotGraphHeightString;
static int yyread(char *buf,int max_size) static int yyread(char *buf,int max_size)
{ {
int c=0; // no file included
while( c < max_size && inputString[inputPosition] ) if (includeStack.isEmpty())
{
int c=0;
while( c < max_size && inputString[inputPosition] )
{
*buf = inputString[inputPosition++] ;
c++; buf++;
}
return c;
}
else
{ {
*buf = inputString[inputPosition++] ; //assert(includeStack.current()->newState==YY_CURRENT_BUFFER);
c++; buf++; return fread(buf,1,max_size,includeStack.current()->filePtr);
} }
return c;
} }
static FILE *tryPath(const char *path,const char *fileName)
{
QCString absName=(QCString)path+"/"+fileName;
QFileInfo fi(absName);
if (fi.exists() && fi.isFile())
{
FILE *f=fopen(absName,"r");
if (!f) err("Error: could not open file %s for reading\n",absName.data());
return f;
}
return 0;
}
static FILE *findFile(const char *fileName)
{
char *s=includePathList.first();
while (s) // try each of the include paths
{
FILE *f = tryPath(s,fileName);
if (f) return f;
s=includePathList.next();
}
// try cwd if includePathList fails
return tryPath(".",fileName);
}
static void readIncludeFile(const char *incName)
{
if (includeDepth==MAX_INCLUDE_DEPTH) {
err("Error: maximum include depth (%d) reached, %s is not included. Aborting...\n",
MAX_INCLUDE_DEPTH,incName);
exit(1);
}
QCString inc = incName;
inc = inc.stripWhiteSpace();
uint incLen = inc.length();
if (inc.at(0)=='"' && inc.at(incLen-1)=='"') // strip quotes
{
inc=inc.mid(1,incLen-2);
}
FILE *f;
//printf("Searching for `%s'\n",incFileName.data());
if ((f=findFile(inc))) // see if the include file can be found
{
// For debugging
#if SHOW_INCLUDES
for (i=0;i<includeStack.count();i++) msg(" ");
msg("@INCLUDE = %s: parsing...\n",inc.data());
#endif
// store the state of the old file
ConfigFileState *fs=new ConfigFileState;
fs->oldState=YY_CURRENT_BUFFER;
fs->lineNr=yyLineNr;
fs->fileName=yyFileName;
fs->filePtr=f;
// push the state on the stack
includeStack.push(fs);
// set the scanner to the include file
yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE));
fs->newState=YY_CURRENT_BUFFER;
yyFileName=inc;
includeDepth++;
}
else
{
err("Error: @INCLUDE = %s: not found!\n",inc.data());
exit(1);
}
}
%} %}
%option noyywrap %option noyywrap
...@@ -220,6 +322,7 @@ static int yyread(char *buf,int max_size) ...@@ -220,6 +322,7 @@ static int yyread(char *buf,int max_size)
%x GetStrList %x GetStrList
%x GetQuotedString %x GetQuotedString
%x GetEnvVar %x GetEnvVar
%x Include
%% %%
...@@ -343,7 +446,37 @@ static int yyread(char *buf,int max_size) ...@@ -343,7 +446,37 @@ static int yyread(char *buf,int max_size)
<Start>"BIN_ABSPATH"[ \t]*"=" { BEGIN(GetString); s=&Config::binAbsPath; s->resize(0); } <Start>"BIN_ABSPATH"[ \t]*"=" { BEGIN(GetString); s=&Config::binAbsPath; s->resize(0); }
<Start>"EXT_DOC_PATHS"[ \t]*"=" { BEGIN(GetStrList); l=&Config::extDocPathList; l->clear(); elemStr=""; } <Start>"EXT_DOC_PATHS"[ \t]*"=" { BEGIN(GetStrList); l=&Config::extDocPathList; l->clear(); elemStr=""; }
<Start>"EXT_DOC_PATHS"[ \t]*"+=" { BEGIN(GetStrList); l=&Config::extDocPathList; elemStr=""; } <Start>"EXT_DOC_PATHS"[ \t]*"+=" { BEGIN(GetStrList); l=&Config::extDocPathList; elemStr=""; }
<Start>[a-z_A-Z0-9]+ { err("Warning: ignoring unknown tag `%s' at line %d\n",yytext,yyLineNr); }
<Start>"@INCLUDE_PATH"[ \t]*"=" { BEGIN(GetStrList); l=&includePathList; l->clear(); elemStr=""; }
/* include a config file */
<Start>"@INCLUDE"[ \t]*"=" { BEGIN(Include);}
<Include>([^ \"\t\r\n]+)|("\""[^\n\"]+"\"") {
readIncludeFile(yytext);
BEGIN(Start);
}
<<EOF>> {
//printf("End of include file\n");
//printf("Include stack depth=%d\n",g_includeStack.count());
if (includeStack.isEmpty())
{
//printf("Terminating scanner!\n");
yyterminate();
}
else
{
ConfigFileState *fs=includeStack.pop();
pclose(fs->filePtr);
YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER;
yy_switch_to_buffer( fs->oldState );
yy_delete_buffer( oldBuf );
yyLineNr=fs->lineNr;
yyFileName=fs->fileName;
delete fs; fs=0;
includeDepth--;
}
}
<Start>[a-z_A-Z0-9]+ { err("Warning: ignoring unknown tag `%s' at line %d, file %s\n",yytext,yyLineNr,yyFileName.data()); }
<GetString,GetBool>\n { yyLineNr++; BEGIN(Start); } <GetString,GetBool>\n { yyLineNr++; BEGIN(Start); }
<GetStrList>\n { <GetStrList>\n {
yyLineNr++; yyLineNr++;
...@@ -367,22 +500,6 @@ static int yyread(char *buf,int max_size) ...@@ -367,22 +500,6 @@ static int yyread(char *buf,int max_size)
BEGIN(GetQuotedString); BEGIN(GetQuotedString);
tmpString.resize(0); tmpString.resize(0);
} }
/*
<GetString,GetStrList,GetQuotedString>"\$\(" {
//printf(">> Enter env\n");
lastEnvState=YY_START;
BEGIN(GetEnvVar);
}
<GetEnvVar>[a-z_A-Z0-9]+")" {
yytext[yyleng-1]='\0';
const char *env=getenv(yytext);
int i;
int l=strlen(env);
//printf("env name=`%s' text=`%s'\n",yytext,env);
for (i=l-1;i>=0;i--) unput(env[i]);
BEGIN(lastEnvState);
}
*/
<GetQuotedString>"\""|"\n" { <GetQuotedString>"\""|"\n" {
//printf("Quoted String = `%s'\n",tmpString.data()); //printf("Quoted String = `%s'\n",tmpString.data());
if (lastState==GetString) if (lastState==GetString)
...@@ -391,7 +508,7 @@ static int yyread(char *buf,int max_size) ...@@ -391,7 +508,7 @@ static int yyread(char *buf,int max_size)
elemStr+=tmpString; elemStr+=tmpString;
if (*yytext=='\n') if (*yytext=='\n')
{ {
err("Warning: Missing end quote (\") on line %d\n",yyLineNr); err("Warning: Missing end quote (\") on line %d, file %s\n",yyLineNr,yyFileName.data());
yyLineNr++; yyLineNr++;
} }
BEGIN(lastState); BEGIN(lastState);
...@@ -411,8 +528,8 @@ static int yyread(char *buf,int max_size) ...@@ -411,8 +528,8 @@ static int yyread(char *buf,int max_size)
{ {
*b=FALSE; *b=FALSE;
warn_cont("Warning: Invalid value `%s' for " warn_cont("Warning: Invalid value `%s' for "
"boolean tag in line %d; use YES or NO\n", "boolean tag in line %d, file %s; use YES or NO\n",
bs.data(),yyLineNr); bs.data(),yyLineNr,yyFileName.data());
} }
} }
<GetStrList>[^ \#\"\t\r\n]+ { <GetStrList>[^ \#\"\t\r\n]+ {
...@@ -807,7 +924,7 @@ static void writeStringList(QTextStream &t,QStrList &l) ...@@ -807,7 +924,7 @@ static void writeStringList(QTextStream &t,QStrList &l)
const char *s=p; const char *s=p;
bool hasBlanks=FALSE; bool hasBlanks=FALSE;
while ((c=*p++)!=0 && !hasBlanks) hasBlanks = (c==' ' || c=='\n' || c=='\t'); while ((c=*p++)!=0 && !hasBlanks) hasBlanks = (c==' ' || c=='\n' || c=='\t');
if (!first) t << " "; if (!first) t << " ";
first=FALSE; first=FALSE;
if (hasBlanks) t << "\"" << s << "\""; else t << s; if (hasBlanks) t << "\"" << s << "\""; else t << s;
p = l.next(); p = l.next();
...@@ -2160,7 +2277,7 @@ static void substEnvVarsInString(QCString &s) ...@@ -2160,7 +2277,7 @@ static void substEnvVarsInString(QCString &s)
QCString env=getenv(s.mid(i+2,l-3)); QCString env=getenv(s.mid(i+2,l-3));
substEnvVarsInString(env); // recursively expand variables if needed. substEnvVarsInString(env); // recursively expand variables if needed.
s = s.left(i)+env+s.right(s.length()-i-l); s = s.left(i)+env+s.right(s.length()-i-l);
p=i+l; p=i+env.length(); // next time start at the end of the expanded string
} }
//printf("substEnvVarInString(%s) end\n",s.data()); //printf("substEnvVarInString(%s) end\n",s.data());
} }
...@@ -2689,11 +2806,15 @@ void checkConfig() ...@@ -2689,11 +2806,15 @@ void checkConfig()
} }
void parseConfig(const QCString &s) void parseConfig(const QCString &s,const char *fn)
{ {
inputString = s; inputString = s;
inputPosition = 0; inputPosition = 0;
yyLineNr = 1; yyLineNr = 1;
yyFileName=fn;
includeStack.setAutoDelete(TRUE);
includeStack.clear();
includeDepth = 0;
configYYrestart( configYYin ); configYYrestart( configYYin );
BEGIN( Start ); BEGIN( Start );
configYYlex(); configYYlex();
......
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
#include "language.h" #include "language.h"
#include "message.h" #include "message.h"
#include "outputlist.h" #include "outputlist.h"
#include "scanner.h" #include "doc.h"
#include "code.h"
#include <qregexp.h> #include <qregexp.h>
Definition::Definition(const char *df,int dl, Definition::Definition(const char *df,int dl,
...@@ -39,6 +40,8 @@ Definition::Definition(const char *df,int dl, ...@@ -39,6 +40,8 @@ Definition::Definition(const char *df,int dl,
bodyDef=0; bodyDef=0;
sourceRefList=0; sourceRefList=0;
sourceRefDict=0; sourceRefDict=0;
m_todoId=0;
m_testId=0;
} }
Definition::~Definition() Definition::~Definition()
......
...@@ -101,6 +101,10 @@ class Definition ...@@ -101,6 +101,10 @@ class Definition
void writeSourceRefs(OutputList &ol,const char *scopeName); void writeSourceRefs(OutputList &ol,const char *scopeName);
void addSourceReference(MemberDef *d); void addSourceReference(MemberDef *d);
void setRefItems(int todoId,int testId) { m_todoId=todoId; m_testId=testId; }
int todoId() const { return m_todoId; }
int testId() const { return m_testId; }
/*! returns the file in which this definition was found */ /*! returns the file in which this definition was found */
QCString getDefFileName() const { return defFileName; } QCString getDefFileName() const { return defFileName; }
/*! returns the line number at which the definition was found */ /*! returns the line number at which the definition was found */
...@@ -124,6 +128,8 @@ class Definition ...@@ -124,6 +128,8 @@ class Definition
MemberList *sourceRefList; // list of entities that refer to this MemberList *sourceRefList; // list of entities that refer to this
// entity in their definition // entity in their definition
MemberDict *sourceRefDict; MemberDict *sourceRefDict;
int m_testId; // id for test case
int m_todoId; // id for todo case
}; };
......
...@@ -475,7 +475,8 @@ void TreeDiagram::computeExtremes(uint *maxLabelLen,uint *maxXPos) ...@@ -475,7 +475,8 @@ void TreeDiagram::computeExtremes(uint *maxLabelLen,uint *maxXPos)
void TreeDiagram::drawBoxes(QTextStream &t,Image *image, void TreeDiagram::drawBoxes(QTextStream &t,Image *image,
bool doBase,bool bitmap, bool doBase,bool bitmap,
uint baseRows,uint superRows, uint baseRows,uint superRows,
uint cellWidth,uint cellHeight) uint cellWidth,uint cellHeight,
bool generateMap)
{ {
DiagramRow *dr=first(); DiagramRow *dr=first();
if (!doBase) dr=next(); if (!doBase) dr=next();
...@@ -543,7 +544,8 @@ void TreeDiagram::drawBoxes(QTextStream &t,Image *image, ...@@ -543,7 +544,8 @@ void TreeDiagram::drawBoxes(QTextStream &t,Image *image,
bool hasDocs=di->getClassDef()->isLinkable(); bool hasDocs=di->getClassDef()->isLinkable();
writeBitmapBox(di,image,x,y,cellWidth,cellHeight,firstRow, writeBitmapBox(di,image,x,y,cellWidth,cellHeight,firstRow,
hasDocs,di->getChildren()->count()>0); hasDocs,di->getChildren()->count()>0);
if (!firstRow) writeMapArea(t,di->getClassDef(),x,y,cellWidth,cellHeight); if (!firstRow && generateMap)
writeMapArea(t,di->getClassDef(),x,y,cellWidth,cellHeight);
} }
else else
{ {
...@@ -575,7 +577,8 @@ void TreeDiagram::drawBoxes(QTextStream &t,Image *image, ...@@ -575,7 +577,8 @@ void TreeDiagram::drawBoxes(QTextStream &t,Image *image,
} }
bool hasDocs=di->getClassDef()->isLinkable(); bool hasDocs=di->getClassDef()->isLinkable();
writeBitmapBox(di,image,x,y,cellWidth,cellHeight,firstRow,hasDocs); writeBitmapBox(di,image,x,y,cellWidth,cellHeight,firstRow,hasDocs);
if (!firstRow) writeMapArea(t,di->getClassDef(),x,y,cellWidth,cellHeight); if (!firstRow && generateMap)
writeMapArea(t,di->getClassDef(),x,y,cellWidth,cellHeight);
} }
else else
{ {
...@@ -1244,7 +1247,7 @@ void ClassDiagram::writeFigure(QTextStream &output,const char *path, ...@@ -1244,7 +1247,7 @@ void ClassDiagram::writeFigure(QTextStream &output,const char *path,
void ClassDiagram::writeImageMap(QTextStream &t,const char *path, void ClassDiagram::writeImageMap(QTextStream &t,const char *path,
const char *fileName) const char *fileName, bool generateMap)
{ {
uint baseRows=base->computeRows(); uint baseRows=base->computeRows();
uint superRows=super->computeRows(); uint superRows=super->computeRows();
...@@ -1271,13 +1274,13 @@ void ClassDiagram::writeImageMap(QTextStream &t,const char *path, ...@@ -1271,13 +1274,13 @@ void ClassDiagram::writeImageMap(QTextStream &t,const char *path,
Image image(imageWidth,imageHeight); Image image(imageWidth,imageHeight);
base->drawBoxes(t,&image,TRUE,TRUE,baseRows,superRows,cellWidth,cellHeight); base->drawBoxes(t,&image,TRUE,TRUE,baseRows,superRows,cellWidth,cellHeight,generateMap);
super->drawBoxes(t,&image,FALSE,TRUE,baseRows,superRows,cellWidth,cellHeight); super->drawBoxes(t,&image,FALSE,TRUE,baseRows,superRows,cellWidth,cellHeight,generateMap);
base->drawConnectors(t,&image,TRUE,TRUE,baseRows,superRows,cellWidth,cellHeight); base->drawConnectors(t,&image,TRUE,TRUE,baseRows,superRows,cellWidth,cellHeight);
super->drawConnectors(t,&image,FALSE,TRUE,baseRows,superRows,cellWidth,cellHeight); super->drawConnectors(t,&image,FALSE,TRUE,baseRows,superRows,cellWidth,cellHeight);
image.save((QCString)path+"/"+fileName+".gif"); image.save((QCString)path+"/"+fileName+".gif");
t << "</map>" << endl; if (generateMap) t << "</map>" << endl;
} }
...@@ -104,7 +104,8 @@ class TreeDiagram : public QList<DiagramRow> ...@@ -104,7 +104,8 @@ class TreeDiagram : public QList<DiagramRow>
void drawBoxes(QTextStream &t,Image *image, void drawBoxes(QTextStream &t,Image *image,
bool doBase,bool bitmap, bool doBase,bool bitmap,
uint baseRows,uint superRows, uint baseRows,uint superRows,
uint cellWidth,uint cellHeight); uint cellWidth,uint cellHeight,
bool generateMap=TRUE);
void drawConnectors(QTextStream &t,Image *image, void drawConnectors(QTextStream &t,Image *image,
bool doBase,bool bitmap, bool doBase,bool bitmap,
uint baseRows,uint superRows, uint baseRows,uint superRows,
...@@ -123,7 +124,7 @@ class ClassDiagram ...@@ -123,7 +124,7 @@ class ClassDiagram
void writeFigure(QTextStream &t,const char *path, void writeFigure(QTextStream &t,const char *path,
const char *file); const char *file);
void writeImageMap(QTextStream &t,const char *path, void writeImageMap(QTextStream &t,const char *path,
const char *file); const char *file,bool generateMap=TRUE);
private: private:
TreeDiagram *base; TreeDiagram *base;
TreeDiagram *super; TreeDiagram *super;
......
/******************************************************************************
*
*
*
* Copyright (C) 1997-2000 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
#ifndef DOC_H
#define DOC_H
#include "qtbc.h"
class OutputList;
extern void parseDoc(OutputList &ol,
const char *fileName,int startLine,
const char *clName, const char *memName,
const QCString &docString);
extern void parseExample(OutputList &ol,const QCString &docString,
const char *fileName);
extern void parseText(OutputList &ol,const QCString &txtString);
#endif
/*****************************************************************************
*
*
*
* Copyright (C) 1997-2000 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
%{
/*
* includes
*/
#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
#include <assert.h>
#include <ctype.h>
#include "qtbc.h"
#include <qarray.h>
#include <qstack.h>
#include <qregexp.h>
#include "doc.h"
#include "code.h"
#include "message.h"
#include "doxygen.h"
#include "config.h"
#include "util.h"
#include "language.h"
#include "outputlist.h"
#include "reflist.h"
#ifndef WIN32
#include <unistd.h>
#endif
#define YY_NEVER_INTERACTIVE 1
/* -----------------------------------------------------------------
*
* scanner's state variables
*/
static bool insideArgumentList;
static QCString className;
static QCString memberName;
static OutputList * outDoc;
static QCString linkRef;
static QCString linkText;
static QCString codeBlock;
static const char * inputString;
static int inputPosition;
static char yyFileName[4096] ;
static int yyLineNr = 1 ;
static bool exampleDoc;
static QCString exampleName;
static QCString htmlUrl,htmlText;
static QCString currentIncludeFile;
static int includeFileOffset = 0;
static int includeFileLength = 0;
static bool firstLine;
static bool inParamBlock;
static bool inRetValBlock;
static bool inExceptionBlock;
static bool inSeeBlock;
static bool inReturnBlock;
static bool inAuthorBlock;
static bool inDeprecatedBlock;
static bool inVersionBlock;
static bool inSinceBlock;
static bool inDateBlock;
static bool inBugBlock;
static bool inNoteBlock;
static bool inPreBlock;
static bool inPostBlock;
static bool inInvarBlock;
static bool inWarningBlock;
static bool inRemarkBlock;
static bool inAttentionBlock;
static bool inParBlock;
static QCString sectionRef;
static bool insideVerbatim = FALSE;
static int depthIf;
//static int currentListIndentLevel;
static QStack<char> currentListIndent;
static QCString curImageName;
static QCString curImageCaption;
static QCString internalRefFile;
static QCString internalRefAnchor;
//-----------------------------------------------------------------------------
static void initParser()
{
insideArgumentList=FALSE;
className.resize(0);
memberName.resize(0);
linkRef.resize(0);
linkText.resize(0);
codeBlock.resize(0);
htmlUrl.resize(0);
htmlText.resize(0);
currentIncludeFile.resize(0);
includeFileOffset = 0;
includeFileLength = 0;
firstLine = TRUE;
inParamBlock = FALSE;
inRetValBlock = FALSE;
inExceptionBlock = FALSE;
inSeeBlock = FALSE;
inReturnBlock = FALSE;
inAuthorBlock = FALSE;
inDeprecatedBlock = FALSE;
inVersionBlock = FALSE;
inSinceBlock = FALSE;
inDateBlock = FALSE;
inBugBlock = FALSE;
inNoteBlock = FALSE;
inPreBlock = FALSE;
inPostBlock = FALSE;
inInvarBlock = FALSE;
inWarningBlock = FALSE;
inRemarkBlock = FALSE;
inAttentionBlock = FALSE;
inParBlock = FALSE;
}
//-----------------------------------------------------------------------------
void scanString(const char *s);
void internalParseDocument(const char *s);
//-----------------------------------------------------------------------------
class TableElem
{
public:
TableElem(int r,int c);
~TableElem();
int getRow() { return row; }
int getCol() { return col; }
OutputList *outputList() { return ol; }
private:
OutputList *ol;
int row;
int col;
};
TableElem::TableElem(int r,int c)
{
//printf("TableElem::TableElem(%d,%d)\n",r,c);
ol=new OutputList(outDoc);
outDoc=ol;
row=r;
col=c;
}
TableElem::~TableElem()
{
//printf("TableElem::~TableElem(%d,%d)\n",row,col);
delete ol; ol=0;
}
class Table
{
public:
Table();
~Table();
void newRow();
void newElem();
private:
OutputList *parentDoc;
QList<TableElem> *elemList;
int curRow;
int curCol;
int rows;
int cols;
};
Table::Table()
{
parentDoc=outDoc;
elemList=new QList<TableElem>;
elemList->setAutoDelete(TRUE);
curRow=curCol=rows=cols=0;
}
Table::~Table()
{
//printf("Table::~Table()\n");
// use elemList & cols & rows
if (cols>0 && rows>0)
{
parentDoc->startTable(cols);
TableElem *e=elemList->first();
while (e)
{
if (e->getRow()>0)
{
if (e->getCol()==0)
{
if (e->getRow()>1) parentDoc->endTableRow();
parentDoc->nextTableRow();
}
else
{
parentDoc->nextTableColumn();
}
*parentDoc+=*e->outputList();
parentDoc->endTableColumn();
}
e=elemList->next();
}
parentDoc->endTable();
}
delete elemList; elemList=0;
outDoc=parentDoc;
}
void Table::newRow()
{
//printf("Table::newRow()\n");
curRow++;
if (curRow>rows) rows=curRow;
curCol=0;
}
void Table::newElem()
{
//printf("Table::newElem(%d,%d)\n",curRow,curCol);
TableElem *te = new TableElem(curRow,curCol);
elemList->append(te);
curCol++;
if (curCol>cols) cols=curCol;
}
static QStack<Table> tableStack;
static Table *curTable;
static void startTable()
{
//printf("startTable()\n");
curTable=new Table;
tableStack.push(curTable);
}
static void endTable()
{
//printf("endTable()\n");
delete tableStack.pop(); // the destructor adds the table to the stream!
curTable=tableStack.top();
}
static void forceEndTable()
{
err("Error: More <table> tags found than </table> "
"tags in documentation block in file %s!\n",yyFileName);
while (!tableStack.isEmpty())
{
endTable();
}
}
//-----------------------------------------------------------------------------
static void endArgumentList()
{
if (insideArgumentList)
{
insideArgumentList=FALSE;
outDoc->endItemList();
}
}
static void includeFile(OutputList &ol,const char *fileName,bool quiet)
{
bool ambig;
FileDef *fd;
if ((fd=findFileDef(exampleNameDict,fileName,ambig)))
{
currentIncludeFile=fileToString(fd->absFilePath());
includeFileOffset=0;
includeFileLength=currentIncludeFile.length();
OutputList codeFrag(&ol);
parseCode(codeFrag,0,currentIncludeFile,exampleDoc,exampleName);
if (!quiet)
{
ol.startCodeFragment();
ol+=codeFrag;
ol.endCodeFragment();
}
}
else if (ambig)
{
QCString text;
text.sprintf("Include file name %s is ambigious.\n",fileName);
text+="Possible candidates:\n";
text+=showFileDefMatches(exampleNameDict,fileName);
warn(yyFileName,yyLineNr,text);
}
else
{
warn(yyFileName,yyLineNr,
"Warning: example file %s is not found. "
"Check your EXAMPLE_PATH",fileName
);
}
}
static void verbIncludeFile(OutputList &ol,const char *name)
{
bool ambig;
FileDef *fd;
if ((fd=findFileDef(exampleNameDict,name,ambig)))
{
ol.startCodeFragment();
ol.codify(fileToString(fd->absFilePath()));
ol.endCodeFragment();
}
else if (ambig)
{
QCString text;
text.sprintf("Include file name %s is ambigious.\n",name);
text+=("Possible candidates:\n");
text+=showFileDefMatches(exampleNameDict,name);
warn(yyFileName,yyLineNr,text);
}
else
{
warn(yyFileName,yyLineNr,
"Warning: example file %s is not found. "
"Check your EXAMPLE_PATH",name);
}
}
static QCString stripQuotes(const char *s)
{
QCString name;
if (s==0 || *s==0) return name;
name=s;
if (name.at(0)=='"' && name.at(name.length()-1)=='"')
{
name=name.mid(1,name.length()-2);
}
return name;
}
static QCString stripKnownExtensions(const char *text)
{
QCString result=text;
if (result.right(4)==".tex") result=result.left(result.length()-4);
else if (result.right(5)==".html") result=result.left(result.length()-5);
//printf("%s stripKnowExtensions(%s)\n",result.data(),text);
return result;
}
static void skipLine(OutputList &ol,const char *key)
{
bool found=FALSE;
while (!found)
{
QCString s;
char c;
while ( includeFileOffset<includeFileLength &&
(c=currentIncludeFile[includeFileOffset++])!='\n' && c!=0
) s+=c;
if (s.find(key)!=-1)
{
found=TRUE;
ol.writeString(" ");
parseCode(ol,className,s,exampleDoc,exampleName);
ol.writeString("\n");
}
else if (includeFileOffset==includeFileLength) found=TRUE;
}
}
static void skipUntil(const char *key)
{
bool found=FALSE;
while (!found)
{
QCString s;
int i=includeFileOffset;
char c;
while ( i<includeFileLength &&
(c=currentIncludeFile[i++])!='\n' && c!=0
) s+=c;
if (s.find(key)!=-1 || i==includeFileLength)
{
found=TRUE;
}
else
{
includeFileOffset=i;
}
}
}
static void showLine(OutputList &ol,const char *key)
{
QCString s;
char c;
bool found=FALSE;
while (!found)
{
while ( includeFileOffset<includeFileLength &&
(c=currentIncludeFile[includeFileOffset++])!='\n' && c!=0
) s+=c;
if (!s.stripWhiteSpace().isEmpty() ||
includeFileOffset==includeFileLength) found=TRUE;
}
if (s.find(key)!=-1)
{
ol.writeString(" ");
parseCode(ol,className,s,exampleDoc,exampleName);
ol.writeString("\n");
}
}
static void showUntil(OutputList &ol,const char *key)
{
bool found=FALSE;
while (!found)
{
QCString s;
char c;
while ( includeFileOffset<includeFileLength &&
(c=currentIncludeFile[includeFileOffset++])!='\n' && c!=0
) s+=c;
if (!s.stripWhiteSpace().isEmpty())
{
ol.writeString(" ");
parseCode(ol,className,s,exampleDoc,exampleName);
ol.writeString("\n");
if (s.find(key)!=-1) found=TRUE;
}
if (includeFileOffset==includeFileLength) found=TRUE;
}
}
//-----------------------------------------------------------------
struct IndentInfo
{
public:
IndentInfo(int i,bool e) : indent(i), enumerated(e) {};
~IndentInfo() {}
void startList()
{
if (enumerated) outDoc->startEnumList(); else outDoc->startItemList();
}
void endList()
{
if (enumerated) outDoc->endEnumList(); else outDoc->endItemList();
}
void writeItem()
{
outDoc->writeListItem();
}
int indent;
bool enumerated;
};
static QStack<IndentInfo> listIndentStack;
static bool insideItemList = FALSE;
static void addListItemMarker(const char *marker,int dashPos,bool enumerated)
{
// find the actual position at which the bullet was found
int i;
int indent=0;
for (i=0;i<dashPos;i++)
{
if (marker[i]=='\t')
{
indent+=Config::tabSize - (indent%Config::tabSize);
}
else
{
indent++;
}
}
//printf("list marker found at column %d enumerated %d\n",indent,enumerated);
if (!insideItemList)
{
listIndentStack.push(new IndentInfo(indent,enumerated));
listIndentStack.top()->startList();
listIndentStack.top()->writeItem();
insideItemList=TRUE;
}
else
{
IndentInfo *pPrevInfo = listIndentStack.top();
if (pPrevInfo->indent==indent && pPrevInfo->enumerated==enumerated)
// new item of same kind at the same indent level
{
pPrevInfo->writeItem();
}
else if (pPrevInfo->indent==indent)
// new item of diffent kind at the same indent level
{
// switch to a diffent list type
pPrevInfo->endList();
pPrevInfo->enumerated=enumerated;
pPrevInfo->startList();
pPrevInfo->writeItem();
}
else if (pPrevInfo->indent<indent) // start sub item list
{
listIndentStack.push(new IndentInfo(indent,enumerated));
listIndentStack.top()->startList();
listIndentStack.top()->writeItem();
}
else // end sub item list
{
pPrevInfo->endList();
listIndentStack.pop();
delete pPrevInfo;
// safe guard against wrong indenting
if (listIndentStack.isEmpty())
{
insideItemList=FALSE;
warn(yyFileName,yyLineNr,
"Warning: list item with invalid indent found!");
}
else
{
listIndentStack.top()->writeItem();
}
}
}
}
// end the current (nested) list regardless of the nesting level.
static void forceEndItemList()
{
IndentInfo *info;
while ((info=listIndentStack.pop())!=0)
{
info->endList();
delete info;
}
insideItemList=FALSE;
}
//-----------------------------------------------------------------
static bool inBlock()
{
return inParamBlock || inRetValBlock || inSeeBlock || inReturnBlock || inAuthorBlock ||
inVersionBlock || inSinceBlock || inDateBlock || inWarningBlock || inRemarkBlock ||
inAttentionBlock || inBugBlock || inNoteBlock ||
inParBlock || inExceptionBlock || inDeprecatedBlock || inPreBlock ||
inPostBlock || inInvarBlock;
}
static void endBlock()
{
if (inParamBlock || inRetValBlock || inExceptionBlock)
{
outDoc->endDescTableData();
outDoc->endDescTable();
}
outDoc->endDescList();
inParamBlock=inRetValBlock=inSeeBlock=inReturnBlock=inAuthorBlock=
inVersionBlock=inSinceBlock=inDateBlock=inBugBlock=inNoteBlock=inWarningBlock=
inParBlock=inExceptionBlock=inDeprecatedBlock=inPreBlock=inPostBlock=
inInvarBlock=inRemarkBlock=inAttentionBlock=FALSE;
}
//-----------------------------------------------------------------
enum ImageTypes
{
IT_Html,
IT_Latex
};
// search for an image in the imageNameDict and if found
// copies the image to the output directory (which is the
// html directory if type==0 or the latex directory if type==1)
static QCString findAndCopyImage(const char *fileName,ImageTypes type)
{
QCString result;
bool ambig;
FileDef *fd;
if ((fd=findFileDef(imageNameDict,fileName,ambig)))
{
QFile inImage(QString(fd->absFilePath().data()));
if (inImage.open(IO_ReadOnly))
{
result = fileName;
int i;
if ((i=result.findRev('/'))!=-1 || (i=result.findRev('\\'))!=-1)
{
result.right(result.length()-i-1);
}
QCString outputDir;
switch(type)
{
case IT_Html:
outputDir = Config::htmlOutputDir;
break;
case IT_Latex:
outputDir = Config::latexOutputDir;
break;
}
QCString outputFile = outputDir+"/"+result;
QFile outImage(QString(outputFile.data()));
if (outImage.open(IO_WriteOnly)) // copy the image
{
char *buffer = new char[inImage.size()];
inImage.readBlock(buffer,inImage.size());
outImage.writeBlock(buffer,inImage.size());
outImage.flush();
delete buffer;
}
else
{
warn(yyFileName,yyLineNr,
"Warning: could not write output image %s",outputFile.data());
}
}
else
{
warn(yyFileName,yyLineNr,
"Warning: could not open image %s",fileName);
}
}
else if (ambig)
{
QCString text;
text.sprintf("Warning: image file name %s is ambigious.\n",fileName);
text+="Possible candidates:\n";
text+=showFileDefMatches(imageNameDict,fileName);
warn(yyFileName,yyLineNr,text);
}
else
{
result=fileName;
if (result.left(5)!="http:" && result.left(6)!="https:")
{
warn(yyFileName,yyLineNr,
"Warning: image file %s is not found in IMAGE_PATH: "
"assuming external image.",fileName
);
}
}
return result;
}
void writeImage(ImageTypes it,const char *size)
{
bool hasCaption=!curImageCaption.isEmpty();
outDoc->pushGeneratorState();
switch(it)
{
case IT_Latex:
{
outDoc->disableAllBut(OutputGenerator::Latex);
outDoc->startImage(curImageName,size,hasCaption);
if (hasCaption)
{
scanString(curImageCaption);
}
outDoc->endImage(hasCaption);
}
break;
case IT_Html:
{
outDoc->disableAllBut(OutputGenerator::Html);
outDoc->startImage(curImageName,0,hasCaption);
if (hasCaption)
{
scanString(curImageCaption);
}
outDoc->endImage(hasCaption);
}
break;
}
outDoc->popGeneratorState();
}
/* ----------------------------------------------------------------- */
#undef YY_INPUT
#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size);
static int yyread(char *buf,int max_size)
{
int c=0;
while( c < max_size && inputString[inputPosition] )
{
*buf = inputString[inputPosition++] ;
//printf("%d (%c)\n",*buf,*buf);
c++; buf++;
}
return c;
}
//ATTR ((({BN}+[^\>]+)/">")?)
%}
CMD ("\\"|"@")
BN [ \t\n\r]
BL [ \t\r]*"\n"
B [ \t]
BS ^(({B}*"//")?)(({B}*"*"+)?){B}*
FILESCHAR [a-z_A-Z0-9\\:\\\/\-\+]
FILEECHAR [a-z_A-Z0-9\-\+]
FILEMASK {FILESCHAR}*{FILEECHAR}+("."{FILESCHAR}*{FILEECHAR}+)+
FILE ({FILESCHAR}*{FILEECHAR}+("."{FILESCHAR}*{FILEECHAR}+)*)|("\""[^\n\"]+"\"")
ID [a-z_A-Z][a-z_A-Z0-9]*
SCOPENAME (({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID})
SCOPEMASK {ID}?(("::"|"#")?(~)?{ID})+
URLMASK [a-z_A-Z0-9\~\:\?\@\#\.\-\+\/\=]+
NONTERM [\{\}\[\]\`\~\@\|\-\+\#\$\/\\\!\%\^\&\*()a-z_A-Z<>0-9]
WORD ({NONTERM}+([^\n\t ]*{NONTERM}+)?)|("\""[^\n\"]"\"")
ATTR ({B}+[^>\n]*)?
A [aA]
BOLD [bB]
BODY [bB][oO][dD][yY]
BR [bB][rR]
EM [eE][mM]
CENTER [cC][eE][nN][tT][eE][rR]
CODE [cC][oO][dD][eE]
DL [dD][lL]
DD [dD][dD]
DT [dD][tT]
DFN [dD][fF][nN]
FORM [fF][oO][rR][mM]
H1 [hH]1
H2 [hH]2
H3 [hH][3-6]
HEAD [hH][eE][aA][dD]
HR [hH][rR]
HREF [hH][rR][eE][fF]
I [iI]
IMG [iI][mM][gG]
INPUT [iI][nN][pP][uU][tT]
LI [lL][iI]
META [mM][eE][tT][aA]
MULTICOL [mM][uU][lL][tT][iI][cC][oO][lL]
NAME [nN][aA][mM][eE]
OL [oO][lL]
P [pP]
PRE [pP][rR][eE]
SMALL [sS][mM][aA][lL][lL]
STRONG [sS][tT][rR][oO][nN][gG]
SUB [sS][uU][bB]
SUP [sS][uU][pP]
SRC [sS][rR][cC]
TABLE [tT][aA][bB][lL][eE]
TITLE [tT][iI][tT][lL][eE]
TD [tT][dD]
TR [tT][rR]
TT [tT][tT]
UL [uU][lL]
VAR [vV][aA][rR]
DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"")
%option noyywrap
%x Text
%x DocScan
%x DocParam
%x DocException
%x DocHtmlScan
%x DocLatexScan
%x DocEmphasis
%x DocBold
%x DocCode
%x DocIf
%x DocCodeBlock
%x DocInternal
%x DocLink
%x DocLinkText
%x DocSkipWord
%x DocInclude
%x DocDontInclude
%x DocHtmlLink
%x DocHtmlAnchor
%x DocHtmlHref1
%x DocHtmlHref2
%x DocSkiplineKey
%x DocSkipKey
%x DocLineKey
%x DocUntilKey
%x DocKeyEnd
%x DocPar
%x DocRefName
%x DocVerbatim
%x DocVerbInc
%x DocIndexWord
%x DocRefArg
%x DocRefArgStart
%x DocRefItem
%x DocRefItemName
%x DocInternalRef
%x DocInternalRefText
%x DocImage
%x DocHtmlImageName
%x DocHtmlImageOpt
%x DocLatexImageName
%x DocLatexImageOpt
%%
<*>\x0d
<DocScan>^{B}*(("//"{B}*)?)"*"*{B}*"-"("#")?{B}+ { /* found list item marker */
QCString text=yytext;
int dashPos = text.findRev('-');
//printf("dashPos=%d char='%c'\n",dashPos,text.at(dashPos+1));
bool isEnumerated = text.at(dashPos+1)=='#';
addListItemMarker(yytext,dashPos,isEnumerated);
}
<DocScan>\n{B}*(("//"{B}*)?)"*"*{B}*"-"("#")?{B}+ { /* found list item marker */
QCString text=yytext;
int dashPos = text.findRev('-');
//printf("dashPos=%d char='%c'\n",dashPos,text.at(dashPos+1));
bool isEnumerated = text.at(dashPos+1)=='#';
addListItemMarker(yytext+1,dashPos,isEnumerated);
}
<DocScan,Text>"&copy;" { outDoc->writeCopyright(); }
<DocScan,Text>"&quot;" { outDoc->writeQuote(); }
<DocScan,Text>"&"[AEIOUYaeiouy]"uml;" { outDoc->writeUmlaut(yytext[1]); }
<DocScan,Text>"&"[AEIOUYaeiouy]"acute;" { outDoc->writeAcute(yytext[1]); }
<DocScan,Text>"&"[AEIOUaeiou]"grave;" { outDoc->writeGrave(yytext[1]); }
<DocScan,Text>"&"[AEIOUaeiou]"circ;" { outDoc->writeCirc(yytext[1]); }
<DocScan,Text>"&"[ANOano]"tilde;" { outDoc->writeTilde(yytext[1]); }
<DocScan,Text>"&szlig;" { outDoc->writeSharpS(); }
<DocScan,Text>"&[aA]ring;" { outDoc->writeRing(yytext[1]); }
<DocScan,DocHtmlScan,DocLatexScan>"$("[a-z_A-Z]+")" {
QCString envvar=&yytext[2];
envvar=envvar.left(envvar.length()-1);
outDoc->docify(getenv(envvar));
}
<DocScan>{CMD}"htmlonly"/[^a-z_A-Z0-9] {
outDoc->pushGeneratorState(); /*storeOutputListState();*/
outDoc->disableAllBut(OutputGenerator::Html);
BEGIN(DocHtmlScan);
}
<DocHtmlScan>{CMD}"endhtmlonly"/[^a-z_A-Z0-9] {
/*restoreOutputListState();*/
outDoc->popGeneratorState();
BEGIN(DocScan);
}
<DocScan>{CMD}"latexonly"/[^a-z_A-Z0-9] {
/*storeOutputListState();*/
outDoc->pushGeneratorState();
outDoc->disableAllBut(OutputGenerator::Latex);
BEGIN(DocLatexScan);
}
<DocLatexScan>{CMD}"endlatexonly"/[^a-z_A-Z0-9] {
/*restoreOutputListState();*/
outDoc->popGeneratorState();
BEGIN(DocScan);
}
<DocHtmlScan,DocLatexScan>"//"|"/*"|"*/" {
outDoc->writeString(yytext);
}
<DocHtmlScan,DocLatexScan>.|\n {
char c[2];
c[0]=*yytext;c[1]='\0';
outDoc->writeString(c);
}
<DocScan>"\\postheader"/{BN}
<DocScan>"\\functionindex"/{BN} { writeMemberList(*outDoc); }
<DocScan>"\\classhierarchy"/{BN} { writeClassHierarchy(*outDoc); }
<DocScan>"\\annotatedclasslist"/{BN} { writeAnnotatedClassList(*outDoc); }
<DocScan>"\\headerfilelist"/{BN} { /*TODO: fix this writeHeaderFileList(*outDoc); */ }
<DocScan>"\\header"/{BN} { BEGIN( DocSkipWord ); }
<DocScan>"\\define"/{BN} { BEGIN( DocSkipWord ); }
<DocScan>{CMD}"verbinclude"/{BN} { BEGIN( DocVerbInc ); }
<DocVerbInc>{FILE} {
verbIncludeFile(*outDoc,stripQuotes(yytext));
BEGIN( DocScan );
}
<DocScan>{CMD}"verbatim"/[^a-z_A-Z0-9] {
outDoc->startCodeFragment();
insideVerbatim=TRUE;
BEGIN(DocVerbatim);
}
<DocVerbatim>{CMD}"endverbatim"/[^a-z_A-Z0-9] {
outDoc->endCodeFragment();
insideVerbatim=FALSE;
BEGIN(DocScan);
}
<DocVerbatim>[^\n\\\@]*"\n" {
//printf("docifying: %s\n",yytext);
outDoc->codify(yytext);
}
<DocVerbatim>"\n"|"//"|"/*"|"*/" {
outDoc->codify(yytext);
}
<DocVerbatim>. {
//printf("char %c\n",*yytext);
char c[2];c[0]=*yytext;c[1]='\0';
outDoc->codify(c);
}
<DocScan>{CMD}"internal"/{BN} {
if (!Config::internalDocsFlag)
{
outDoc->newParagraph();
scanString(theTranslator->trForInternalUseOnly()+"\n");
//outDoc->writeString("For internal use only.\n");
BEGIN( DocInternal );
}
}
<DocScan>"\\reimp"/{BN} {
outDoc->newParagraph();
scanString(theTranslator->trReimplementedForInternalReasons()+"\n");
}
<DocScan>{CMD}"link"/{BN} { BEGIN( DocLink ); }
<DocSkipWord>[a-z_A-Z0-9.:()]+ { BEGIN( DocScan ); }
<DocLink>[a-z_A-Z0-9:#.,~&*/<>()\-\+]+ { // TODO: support operators as well!
linkRef = stripKnownExtensions(yytext);
linkText = "";
BEGIN( DocLinkText );
}
<DocLinkText>. { linkText += *yytext; }
<DocLinkText>"\n" { linkText += " "; }
<DocLink,DocLinkText>{CMD}"endlink" { // <- needed for things like \endlink.
//printf("GenerateLink className=`%s' linkRef=`%s' linkText=`%s'\n",
// className.data(),linkRef.data(),linkText.data());
generateLink(*outDoc,className,linkRef,inSeeBlock,linkText.stripWhiteSpace());
BEGIN( DocScan );
}
<DocScan>{CMD}"endlink"/[^a-z_A-Z0-9] { warn(yyFileName,yyLineNr,
"Warning: \\endlink without \\link "
"in documentation."
);
}
<DocScan>{CMD}"addindex"{B}+ {
BEGIN(DocIndexWord);
}
<DocScan>"\\form#"[0-9]+ {
Formula *formula=formulaNameDict[yytext];
if (formula)
{
QCString formName;
formName.sprintf("form-%d.gif",formula->getId());
outDoc->writeFormula(formName,formula->getFormulaText());
}
}
<DocIndexWord>[^\n]+ {
//printf("Adding %s to index\n",yytext);
outDoc->addToIndex(yytext,0);
BEGIN(DocScan);
}
<DocScan>{CMD}("arg"|"li")/{BN} {
if (insideArgumentList)
{
outDoc->writeListItem();
}
else
{
outDoc->startItemList();
outDoc->writeListItem();
insideArgumentList=TRUE;
}
}
<DocScan>(({B}*"\n"){2,}{B}*)?{CMD}"par"{B}* {
BEGIN(DocPar);
}
<DocPar>[^\n]*{BN} {
QCString title=QCString(yytext).stripWhiteSpace();
bool b = inBlock();
if (!title.isEmpty())
{
endArgumentList();
if (b) endBlock();
inParBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
outDoc->docify(title);
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->newParagraph();
}
BEGIN(DocScan);
}
<DocScan>{CMD}"warning"/{BN} {
endArgumentList();
if (!inWarningBlock)
{
if (inBlock()) endBlock();
inWarningBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trWarning()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"remark"[s]?/{BN} {
endArgumentList();
if (!inRemarkBlock)
{
if (inBlock()) endBlock();
inRemarkBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trRemarks()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"attention"[s]?/{BN} {
endArgumentList();
if (!inAttentionBlock)
{
if (inBlock()) endBlock();
inAttentionBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trAttention()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"bug"[s]?/{BN} {
endArgumentList();
if (!inBugBlock)
{
if (inBlock()) endBlock();
inBugBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trBugsAndLimitations()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"note"[s]?/{BN} {
endArgumentList();
if (!inNoteBlock)
{
if (inBlock()) endBlock();
inNoteBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trNote()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"pre"/{BN} {
endArgumentList();
if (!inPreBlock)
{
if (inBlock()) endBlock();
inPreBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trPrecondition()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"post"/{BN} {
endArgumentList();
if (!inPostBlock)
{
if (inBlock()) endBlock();
inPostBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trPostcondition()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"invariant"/{BN} {
endArgumentList();
if (!inInvarBlock)
{
if (inBlock()) endBlock();
inInvarBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trInvariant()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"version"/{BN} {
endArgumentList();
if (!inVersionBlock)
{
if (inBlock()) endBlock();
inVersionBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trVersion()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"since"/{BN} {
endArgumentList();
if (!inSinceBlock)
{
if (inBlock()) endBlock();
inSinceBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trSince()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"date"/{BN} {
endArgumentList();
if (!inDateBlock)
{
if (inBlock()) endBlock();
inDateBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trDate()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>"\\todo "[0-9]+ { // this tag is generated in an earlier pass
if (Config::generateTodoList)
{
QCString numStr=yytext;
numStr=numStr.right(numStr.length()-6);
bool ok; int num = numStr.toUInt(&ok);
RefItem *item = todoList.getRefItem(num);
ASSERT(item!=0);
endArgumentList();
if (inBlock()) endBlock();
outDoc->startDescList();
outDoc->startBold();
outDoc->writeObjectLink(0,"todo",item->listAnchor,theTranslator->trTodo()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
internalParseDocument(item->text);
outDoc->endDescList();
}
}
<DocScan>"\\test "[0-9]+ { // this tag is generated in an earlier pass
if (Config::generateTestList)
{
QCString numStr=yytext;
numStr=numStr.right(numStr.length()-6);
bool ok; int num = numStr.toUInt(&ok);
RefItem *item = testList.getRefItem(num);
ASSERT(item!=0);
endArgumentList();
if (inBlock()) endBlock();
outDoc->startDescList();
outDoc->startBold();
outDoc->writeObjectLink(0,"test",item->listAnchor,theTranslator->trTest()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
internalParseDocument(item->text);
outDoc->endDescList();
}
}
<DocScan>{CMD}"deprecated"/{BN} {
endArgumentList();
if (!inDeprecatedBlock)
{
if (inBlock()) endBlock();
inDeprecatedBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trDeprecated()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>"$"[a-zA-Z_0-9]+":"[^\n\$]+"$" { // RCS tag
QCString tagName(&yytext[1]);
int i=tagName.find(':');
tagName=tagName.left(i);
QCString tagText=&yytext[i+2];
tagText=tagText.left(tagText.length()-1);
endArgumentList();
if (inBlock()) endBlock();
outDoc->startDescList();
outDoc->startBold();
scanString(tagName+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
scanString(tagText);
outDoc->endDescList();
}
<DocScan>{CMD}"author"/{BN} {
endArgumentList();
if (!inAuthorBlock)
{
if (inBlock()) endBlock();
inAuthorBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trAuthors()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->docify(", ");
}
}
<DocScan>{CMD}("return"([s])?|"result")/{BN} {
endArgumentList();
if (!inReturnBlock)
{
if (inBlock()) endBlock();
inReturnBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trReturns()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
}
<DocScan>{CMD}("sa"|"see")/{BN} {
endArgumentList();
if (!inSeeBlock)
{
if (inBlock()) endBlock();
inSeeBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trSeeAlso()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->docify(", ");
}
}
<DocScan>(({B}*"\n"){2,}{B}*)?{CMD}"param"/{BN} {
QCString t=yytext;
if (t.contains('\n')>1 && insideItemList)
{
forceEndItemList();
}
endArgumentList();
if (!inParamBlock)
{
if (inBlock()) endBlock();
inParamBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trParameters()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
outDoc->startDescTable();
}
else
{
outDoc->endDescTableData();
}
BEGIN(DocParam);
}
<DocScan>(({B}*"\n"){2,}{B}*)?{CMD}"retval"/{BN} {
QCString t=yytext;
if (t.contains('\n')>1 && insideItemList)
{
forceEndItemList();
}
endArgumentList();
if (!inRetValBlock)
{
if (inBlock()) endBlock();
inRetValBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trReturnValues()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
outDoc->startDescTable();
}
else
{
outDoc->endDescTableData();
}
BEGIN(DocParam);
}
<DocScan>(({B}*"\n"){2,}{B}*)?{CMD}("exception"|"throw")s?/{BN} {
QCString t=yytext;
if (t.contains('\n')>1 && insideItemList)
{
forceEndItemList();
}
endArgumentList();
if (!inExceptionBlock)
{
if (inBlock()) endBlock();
inExceptionBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trExceptions()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
outDoc->startDescTable();
}
else
{
outDoc->endDescTableData();
}
BEGIN(DocException);
}
<DocScan>"\\capt".*
<DocParam>({DOCPARAM}{BN}*","{BN}*)*{DOCPARAM} {
outDoc->startDescTableTitle();
outDoc->startEmphasis();
outDoc->docify(substitute(yytext,"\"",""));
outDoc->endEmphasis();
outDoc->endDescTableTitle();
outDoc->startDescTableData();
BEGIN(DocScan);
}
<DocException>{SCOPENAME} {
outDoc->startDescTableTitle();
outDoc->startEmphasis();
outDoc->docify(yytext);
outDoc->endEmphasis();
outDoc->endDescTableTitle();
outDoc->startDescTableData();
BEGIN(DocScan);
}
<DocScan>{CMD}"section "{ID}"\n" {
QCString secName=&yytext[9]; // skip "\section "
secName=secName.left(secName.length()-1); // remove \n
//printf("SectionName %s found\n",secName.data());
SectionInfo *sec;
if ((sec=sectionDict[secName]))
{
//printf("Title %s\n",sec->title.data());
outDoc->writeSection(sec->label,sec->title,
sec->type==SectionInfo::Subsection);
}
}
<DocScan>{CMD}"anchor "{ID}"\n" {
QCString secName=&yytext[8];
secName=secName.left(secName.length()-1);
SectionInfo *sec;
if ((sec=sectionDict[secName]))
{
//printf("writeAnchor %s_%s\n",sec->fileName.data(),sec->label.data());
outDoc->writeAnchor(sec->fileName,sec->label);
}
}
<DocScan>"\\_internalref"{B}+ { // for internal use only!
internalRefFile.resize(0);
internalRefAnchor.resize(0);
BEGIN(DocInternalRef);
}
<DocInternalRef>[A-Z_a-z0-9.:\-\+]+ {
internalRefFile=yytext;
int i = internalRefFile.find(':');
if (i!=-1)
{
internalRefAnchor=internalRefFile.right(internalRefFile.length()-i-1);
internalRefFile=internalRefFile.left(i);
}
//printf("InternalRef yytext=`%s' file=`%s' anchor=`%s'\n",yytext,internalRefFile.data(),internalRefAnchor.data());
BEGIN(DocInternalRefText);
}
<DocInternalRefText>\"[^\n\"]*\" {
QCString text=substitute(yytext,"\"","");
outDoc->writeObjectLink(0,internalRefFile,internalRefAnchor,text);
BEGIN(DocScan);
}
<DocScan>{CMD}"ref" {
BEGIN(DocRefName);
}
<DocScan>{CMD}"refitem" {
BEGIN(DocRefItem);
}
<DocScan>{CMD}"if"/{BN} {
outDoc->pushGeneratorState();
depthIf++;
BEGIN(DocIf);
}
<DocScan>{CMD}"endif"/[^a-z_A-Z0-9] {
if (--depthIf<0)
{
warn(yyFileName,yyLineNr,
"Warning: documentation block contains \\endif without "
"matching \\if found in documentation."
);
}
else
{
outDoc->popGeneratorState();
}
}
<DocIf>[^\n\t ]+ {
if (Config::sectionFilterList.find(yytext)==-1)
{
outDoc->disableAll();
}
BEGIN(DocScan);
}
<DocRefName>{SCOPENAME}|{FILE} {
QCString ref=yytext;
SectionInfo *sec;
if ((sec=sectionDict[ref]))
{
QCString text;
if (sec->title.isEmpty())
text=sec->label;
else
text=sec->title;
if (sec->type==SectionInfo::Anchor)
{
//outDoc->writeSectionRefAnchor(sec->fileName,sec->label,text);
outDoc->writeObjectLink(0,sec->fileName,sec->label,text);
writePageRef(*outDoc,sec->label,0);
}
else
{
//printf(" ref sec=%p sec->fileName=%s text=%s\n",sec,sec->fileName.data(),text.data());
outDoc->writeSectionRef(sec->fileName,sec->label,text);
}
}
else if (!generateLink(*outDoc,className,yytext,TRUE,0))
{
warn(yyFileName,yyLineNr,"Warning: reference to unknown section %s!",yytext);
//outDoc->writeBoldString(" unknown reference! ");
}
BEGIN(DocScan);
}
<DocRefName>({SCOPENAME}|{FILE}){B}+/"\"" {
sectionRef=yytext;
sectionRef=sectionRef.stripWhiteSpace();
BEGIN(DocRefArgStart);
}
<DocRefArgStart>"\"" {
BEGIN(DocRefArg);
}
<DocRefArg>[^\"\n]+[\n\"] {
yytext[yyleng-1]='\0';
QCString text=substitute(yytext,"\\\\","\\");
SectionInfo *sec;
if ((sec=sectionDict[sectionRef]))
{
if (sec->type==SectionInfo::Anchor)
{
//outDoc->writeSectionRefAnchor(sec->fileName,sec->label,text);
outDoc->writeObjectLink(0,sec->fileName,sec->label,text);
//printf("Writing page ref `%s'\n",sec->label.data());
writePageRef(*outDoc,sec->label,0);
}
else
{
outDoc->writeSectionRef(sec->fileName,sec->label,text);
}
}
else if (!generateLink(*outDoc,className,sectionRef,TRUE,text))
{
warn(yyFileName,yyLineNr,"Warning: reference to unknown section %s!",sectionRef.data());
outDoc->writeBoldString(" unknown reference! ");
}
BEGIN(DocScan);
}
<DocRefItem>{ID} {
sectionRef=yytext;
BEGIN(DocRefItemName);
}
<DocRefItemName>.*/"\n" {
SectionInfo *sec;
QCString text=yytext;
if ((sec=sectionDict[sectionRef]))
{
outDoc->writeSectionRefItem(sec->fileName,sec->label,text.stripWhiteSpace());
}
else
{
warn(yyFileName,yyLineNr,"Warning: reference to unknown section %s!",sectionRef.data());
outDoc->writeBoldString(" unknown reference! ");
}
BEGIN(DocScan);
}
<DocScan>{CMD}"image"{B}+ {
BEGIN(DocImage);
}
<DocImage>[hH][tT][mM][lL] {
BEGIN(DocHtmlImageName);
}
<DocImage>[lL][aA][tT][eE][xX] {
BEGIN(DocLatexImageName);
}
<DocHtmlImageName>{FILE}|{URLMASK} {
curImageName = findAndCopyImage(stripQuotes(yytext),IT_Html);
curImageCaption.resize(0);
if (curImageName.isEmpty())
{
BEGIN(DocScan);
}
else
{
BEGIN(DocHtmlImageOpt);
}
}
<DocHtmlImageOpt>\n {
writeImage(IT_Html,0);
BEGIN(DocScan);
}
<DocHtmlImageOpt>\"[^\n"]*\" {
curImageCaption=stripQuotes(yytext);
}
<DocLatexImageName>{FILE} {
curImageName = findAndCopyImage(stripQuotes(yytext),IT_Latex);
curImageCaption.resize(0);
if (curImageName.isEmpty())
BEGIN(DocScan);
else
BEGIN(DocLatexImageOpt);
}
<DocLatexImageOpt>\n { // no width specified
writeImage(IT_Latex,0);
BEGIN(DocScan);
}
<DocLatexImageOpt>\"[^\n"]*\" {
curImageCaption=stripQuotes(yytext);
}
<DocLatexImageOpt>("width"{B}*"="{B}*)(([0-9\.]+({B}*{ID})?)|("\\"{ID})) {
writeImage(IT_Latex,yytext);
BEGIN(DocScan);
}
<DocLatexImageOpt>("height"{B}*"="{B}*)(([0-9\.]+({B}*{ID})?)|("\\"{ID})) {
writeImage(IT_Latex,yytext);
BEGIN(DocScan);
}
<DocImage>[a-z_A-Z0-9\.\-]+ {
warn(yyFileName,yyLineNr,"Warning: %s is an unsupported output format for \\image",yytext);
}
<DocImage,DocHtmlImageName,DocLatexImageName>\n {
warn(yyFileName,yyLineNr,"Warning: invalid \\image command found!");
outDoc->enableAll();
BEGIN(DocScan);
}
<DocScan>{CMD}"code"({BN}*"\n"|{B}*) {
outDoc->startCodeFragment();
codeBlock.resize(0);
BEGIN( DocCodeBlock );
}
<DocScan>{CMD}"endcode"/[^a-z_A-Z0-9] {
warn(yyFileName,yyLineNr,"Warning: \\endcode without <PRE> or \\code "
"in the documentation.");
}
<DocScan,DocRefName>{ID}"<"[^>\ \t\n]*">"("::"{ID})+"("?[a-z_A-Z0-9,:\<\> \t\*\&]*")"? {
generateRef(*outDoc,className,yytext,inSeeBlock);
BEGIN(DocScan);
}
<DocScan,DocRefName>{SCOPEMASK}"("[a-z_A-Z0-9,:\<\> \t\*\&]+")" {
generateRef(*outDoc,className,yytext,inSeeBlock);
BEGIN(DocScan);
}
<DocScan,DocRefName>{SCOPEMASK}("()")? {
generateRef(*outDoc,className,yytext,inSeeBlock);
BEGIN(DocScan);
}
<DocScan,DocRefName>({SCOPEMASK}"::")?"operator()("[a-z_A-Z0-9,\<\> \t\*\&]*")" {
QCString oName=yytext;
generateRef(*outDoc,className,
removeRedundantWhiteSpace(oName),inSeeBlock);
BEGIN(DocScan);
}
<DocScan,DocRefName>({SCOPEMASK}"::")?"operator"[^(\r\n.,]+"("[a-z_A-Z0-9,\<\> \t\*\&]*")" {
QCString oName=yytext;
generateRef(*outDoc,className,
removeRedundantWhiteSpace(oName),inSeeBlock);
BEGIN(DocScan);
}
<DocScan>("http:"|"https:"|"ftp:"|"file:"){URLMASK} { outDoc->writeHtmlLink(yytext,yytext); }
<DocScan>[a-zA-Z_0-9\.\-]+"@"[0-9a-z_A-Z\.\-]+ { outDoc->writeMailLink(yytext); }
<DocScan>{FILEMASK} {
generateFileRef(*outDoc,yytext);
}
<DocCodeBlock>{BN}*{CMD}"endcode"/[^a-z_A-Z0-9] { // needed to match things like \endcode. (note the dot)
parseCode(*outDoc,className,codeBlock,exampleDoc,exampleName);
//printf("Code block\n-------------\n%s\n--------------\n",codeBlock.data());
outDoc->endCodeFragment();
BEGIN( DocScan );
}
<DocCodeBlock>"</"{PRE}{ATTR}">" {
parseCode(*outDoc,className,codeBlock,exampleDoc,exampleName);
//printf("Code block\n-------------\n%s\n--------------\n",codeBlock.data());
outDoc->endCodeFragment();
BEGIN( DocScan );
}
<DocScan>{CMD}("e"|"em"|"a"){BN}+ { BEGIN( DocEmphasis ); }
<DocScan>{CMD}"b"{BN}+ { BEGIN( DocBold ); }
<DocScan>{CMD}("c"|"p"){BN}+ { BEGIN( DocCode ); }
<DocScan>{CMD}"l"{BN}+
<DocScan>"\\n"/[^a-z_A-Z0-9] { outDoc->lineBreak(); }
<DocScan>{CMD}"include"{BN}+ { BEGIN( DocInclude ); }
<DocScan>{CMD}"dontinclude"{BN}+ { BEGIN( DocDontInclude ); }
<DocScan>{CMD}"skip"{BN}+ { BEGIN( DocSkipKey ); }
<DocScan>{CMD}"skipline"{BN}+ { BEGIN( DocSkiplineKey ); firstLine=TRUE; }
<DocScan>{CMD}"line"{BN}+ { BEGIN( DocLineKey ); firstLine=TRUE; }
<DocScan>{CMD}"until"{BN}+ { BEGIN( DocUntilKey ); firstLine=TRUE; }
<DocSkipKey>[^ \t\r\n]+ {
if (includeFileLength>0)
skipUntil(yytext);
BEGIN( DocScan );
}
<DocLineKey>[^ \t\r\n]+ {
if (includeFileLength>0)
{
if (firstLine) outDoc->startCodeFragment();
firstLine=FALSE;
showLine(*outDoc,yytext);
BEGIN( DocKeyEnd );
}
else
{
BEGIN( DocScan );
}
}
<DocSkiplineKey>[^ \t\r\n]+ {
if (includeFileLength>0)
{
if (firstLine) outDoc->startCodeFragment();
firstLine=FALSE;
skipLine(*outDoc,yytext);
BEGIN( DocKeyEnd );
}
else
{
BEGIN( DocScan );
}
}
<DocUntilKey>[^ \t\r\n]+ {
if (includeFileLength>0)
{
if (firstLine) outDoc->startCodeFragment();
firstLine=FALSE;
showUntil(*outDoc,yytext);
BEGIN( DocKeyEnd );
}
else
{
BEGIN( DocScan );
}
}
<DocKeyEnd>{CMD}"line"{BN}+ { BEGIN(DocLineKey); }
<DocKeyEnd>{CMD}"until"{BN}+ { BEGIN(DocUntilKey); }
<DocKeyEnd>{CMD}"skipline"{BN}+ { BEGIN(DocSkiplineKey); }
<DocKeyEnd>\n
<DocKeyEnd><<EOF>> {
if (!firstLine) outDoc->endCodeFragment();
yyterminate();
}
<DocKeyEnd>. {
unput(*yytext);
if (!firstLine) outDoc->endCodeFragment();
BEGIN( DocScan );
}
<DocScan>"<"{MULTICOL}{ATTR}">"
<DocScan>"</"{MULTICOL}{ATTR}">"
<DocScan>"<"{STRONG}{ATTR}">" { outDoc->startBold(); }
<DocScan>"</"{STRONG}{ATTR}">" { outDoc->endBold(); }
<DocScan>"<"{CENTER}{ATTR}">" { outDoc->startCenter(); }
<DocScan>"</"{CENTER}{ATTR}">" { outDoc->endCenter(); }
<DocScan>"<"{TABLE}{ATTR}">" { startTable(); }
<DocScan>"</"{TABLE}{ATTR}">" { endTable(); }
<DocScan>"<"{INPUT}{ATTR}">"
<DocScan>"<"{SMALL}{ATTR}">" { outDoc->startSmall(); }
<DocScan>"</"{SMALL}{ATTR}">" { outDoc->endSmall(); }
<DocScan>"<"{META}{ATTR}">"
<DocScan>"<"{FORM}{ATTR}">"
<DocScan>"</"{FORM}{ATTR}">"
<DocScan>"<"{HEAD}{ATTR}">"
<DocScan>"</"{HEAD}{ATTR}">"
<DocScan>"<"{BODY}{ATTR}">"
<DocScan>"</"{BODY}{ATTR}">"
<DocScan>"<"{CODE}{ATTR}">" { outDoc->startTypewriter(); }
<DocScan>"</"{CODE}{ATTR}">" { outDoc->endTypewriter(); }
<DocScan>"<"{DFN}{ATTR}">" { outDoc->startTypewriter(); }
<DocScan>"</"{DFN}{ATTR}">" { outDoc->endTypewriter(); }
<DocScan>"<"{VAR}{ATTR}">" { outDoc->startEmphasis(); }
<DocScan>"</"{VAR}{ATTR}">" { outDoc->endEmphasis(); }
<DocScan>"<"{IMG}{ATTR}">" {
/*storeOutputListState();*/
outDoc->pushGeneratorState();
outDoc->disableAllBut(OutputGenerator::Html);
outDoc->writeString(yytext);
/*restoreOutputListState();*/
outDoc->popGeneratorState();
}
<DocScan>"<"{PRE}{ATTR}">" {
outDoc->startCodeFragment();
codeBlock.resize(0);
BEGIN( DocCodeBlock );
}
<DocScan>"</"{PRE}{ATTR}">" {
warn(yyFileName,yyLineNr,
"Warning: </PRE> without <PRE> or \\code"
"in the documentation."
);
}
<DocScan>"<"{SUB}{ATTR}">" { outDoc->startSubscript(); }
<DocScan>"</"{SUB}{ATTR}">" { outDoc->endSubscript(); }
<DocScan>"<"{SUP}{ATTR}">" { outDoc->startSuperscript(); }
<DocScan>"</"{SUP}{ATTR}">" { outDoc->endSuperscript(); }
<DocScan>"<"{TR}{ATTR}">" { if (curTable) curTable->newRow(); }
<DocScan>"</"{TR}{ATTR}">"
<DocScan>"<"{TD}{ATTR}">" { if (curTable) curTable->newElem(); }
<DocScan>"</"{TD}{ATTR}">"
<DocScan>"<"{OL}{ATTR}">" { outDoc->startEnumList();
currentListIndent.push("O");
}
<DocScan>"</"{OL}{ATTR}">" {
if (currentListIndent.isEmpty())
{
warn(yyFileName,yyLineNr,
"Warning: more </ol> tags than <ol> tags in the documentation."
);
}
else if (currentListIndent.top()!="O")
{
warn(yyFileName,yyLineNr,
"Warning: </ol> tag does not end a <ol> tag in the documentation."
);
}
else
{
outDoc->endEnumList();
currentListIndent.pop();
}
}
<DocScan>"<"{UL}{ATTR}">" { outDoc->startItemList();
currentListIndent.push("U");
}
<DocScan>"</"{UL}{ATTR}">" {
if (currentListIndent.isEmpty())
{
warn(yyFileName,yyLineNr,
"Warning: more </ul> tags than <ul> tags in the documentation."
);
}
else if (currentListIndent.top()!="U")
{
warn(yyFileName,yyLineNr,
"Warning: </ul> tag does not end a <ul> tag in the documentation."
);
}
else
{
outDoc->endItemList();
currentListIndent.pop();
}
}
<DocScan>"<"{LI}{ATTR}">" {
if (/*currentListIndent.isEmpty() ||*/ //DvH: I removed this check because I use this in the manual (the <ul> is in a \htmlonly block!)
currentListIndent.top()=="D")
{
warn(yyFileName,yyLineNr,
"Warning: The <li> tag can only be used inside a <ul> ... </ul> or a <ol> ... </ol> block."
);
}
else
{
outDoc->writeListItem();
}
}
<DocScan>"</"{LI}{ATTR}">"
<DocScan>"<"{TT}{ATTR}">" { outDoc->startTypewriter(); }
<DocScan>"</"{TT}{ATTR}">" { outDoc->endTypewriter(); }
<DocScan>"<"{EM}{ATTR}">" { outDoc->startEmphasis(); }
<DocScan>"</"{EM}{ATTR}">" { outDoc->endEmphasis(); }
<DocScan>"<"{HR}{ATTR}">" { outDoc->writeRuler(); }
<DocScan>"<"{DL}{ATTR}">" { outDoc->startDescription();
currentListIndent.push("D");
}
<DocScan>"</"{DL}{ATTR}">" {
if (currentListIndent.isEmpty())
{
warn(yyFileName,yyLineNr,
"Warning: more </dl> tags than <dl> tags in the documentation."
);
}
else if (currentListIndent.top()!="D")
{
warn(yyFileName,yyLineNr,
"Warning: </dl> tag does not end a <dl> tag in the documentation."
);
}
else
{
outDoc->endDescription();
currentListIndent.pop();
}
}
<DocScan>"<"{DT}{ATTR}">" {
if (currentListIndent.isEmpty() ||
currentListIndent.top()!="D")
{
warn(yyFileName,yyLineNr,
"Warning: The <dt> tag can only be used inside a <dl> ... </dl> block."
);
}
else
{
outDoc->startDescItem();
}
}
<DocScan>"</"{DT}{ATTR}">"
<DocScan>"<"{DD}{ATTR}">" {
if (currentListIndent.isEmpty() ||
currentListIndent.top()!="D")
{
warn(yyFileName,yyLineNr,
"Warning: The <dd> tag can only be used inside a <dl> ... </dl> block."
);
}
else
{
outDoc->endDescItem();
}
}
<DocScan>"</"{DD}{ATTR}">"
<DocScan>"<"{BR}{ATTR}">" { outDoc->lineBreak(); }
<DocScan>"<"{I}{ATTR}">" { outDoc->startEmphasis(); }
<DocScan>"</"{I}{ATTR}">" { outDoc->endEmphasis(); }
<DocScan>"</"{A}{ATTR}">"
<DocScan>"<"{A} { BEGIN(DocHtmlLink); }
<DocScan>"<"{BOLD}{ATTR}">" { outDoc->startBold(); }
<DocScan>"</"{BOLD}{ATTR}">" { outDoc->endBold(); }
<DocScan>"<"{P}{ATTR}">" {
if (inBlock()) endBlock();
outDoc->newParagraph(); }
<DocScan>"</"{P}{ATTR}">"
<DocScan>"<"{H1}{ATTR}">" { outDoc->startTitle(); }
<DocScan>"</"{H1}{ATTR}">" { outDoc->endTitle(); }
<DocScan>"<"{H2}{ATTR}">" { outDoc->startSubsection(); }
<DocScan>"</"{H2}{ATTR}">" { outDoc->endSubsection(); }
<DocScan>"<"{H3}{ATTR}">" { outDoc->startSubsubsection(); }
<DocScan>"</"{H3}{ATTR}">" { outDoc->endSubsubsection(); }
<DocHtmlLink>{NAME}{BN}*"="{BN}*("\""?) { BEGIN(DocHtmlAnchor); }
<DocHtmlAnchor>[a-z_A-Z0-9.\-\+\/]+ { outDoc->writeAnchor(0,yytext); }
<DocHtmlLink>{HREF}{BN}*"="{BN}*("\""?) {
htmlUrl.resize(0);
htmlText.resize(0);
BEGIN(DocHtmlHref1); }
<DocHtmlHref1>{URLMASK} {
htmlUrl=yytext;
}
<DocHtmlHref1>">" { BEGIN(DocHtmlHref2); }
<DocHtmlHref2>[^<]* { htmlText+=yytext; }
<DocHtmlHref2>"<" {
outDoc->writeHtmlLink(htmlUrl,htmlText);
unput(*yytext);
BEGIN(DocScan);
}
<DocHtmlLink,DocHtmlAnchor>">" { BEGIN(DocScan); }
<DocScan>{CMD}("\\"|"@"|"<"|">"|"&"|"$"|"#"|"%") {
outDoc->docify(&yytext[1]);
}
<DocScan>"%"[a-zA-Z_0-9\-]+ {
outDoc->docify(yytext+1);
}
<DocEmphasis>[a-z_A-Z][a-z_A-Z:0-9<>&\-=^%~!\[\]()|\*/]*"("[a-z_A-Z0-9,:\<\> \t\*\&]*")" {
outDoc->startEmphasis();
generateRef(*outDoc,className,yytext,inSeeBlock);
outDoc->endEmphasis();
BEGIN( DocScan );
}
<DocEmphasis>{WORD} {
outDoc->startEmphasis();
linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE);
outDoc->endEmphasis();
BEGIN( DocScan );
}
<DocBold>[a-z_A-Z][a-z_A-Z:0-9<>&\-=^%~!\[\]()|\*/]*"("[a-z_A-Z0-9,:\<\> \t\*\&]*")" {
outDoc->startBold();
generateRef(*outDoc,className,yytext,inSeeBlock);
outDoc->endBold();
BEGIN( DocScan );
}
<DocBold>{WORD} {
outDoc->startBold();
linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE);
outDoc->endBold();
BEGIN( DocScan );
}
<DocCode>[a-z_A-Z][a-z_A-Z:0-9<>&\-=^%~!\[\]()!\*/]*"("[a-z_A-Z0-9,:\<\> \t\*\&]*")" {
outDoc->startTypewriter();
generateRef(*outDoc,className,yytext,inSeeBlock);
outDoc->endTypewriter();
BEGIN( DocScan );
}
<DocCode>{WORD} {
outDoc->startTypewriter();
linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE);
outDoc->endTypewriter();
BEGIN( DocScan );
}
<DocInclude>{FILE} {
includeFile(*outDoc,stripQuotes(yytext),FALSE);
BEGIN( DocScan );
}
<DocDontInclude>{FILE} {
includeFile(*outDoc,stripQuotes(yytext),TRUE);
BEGIN( DocScan );
}
<DocCodeBlock>"//" { codeBlock += yytext; }
<DocCodeBlock>"/*" { codeBlock += yytext; }
<DocCodeBlock>\n { codeBlock += '\n'; }
<DocCodeBlock>[^\/\\\<\n]* { codeBlock += yytext; }
<DocCodeBlock>. { codeBlock += *yytext; }
<DocCode,DocEmphasis,DocScan,DocBold>"//" {
outDoc->docify(yytext);
}
<DocCode,DocEmphasis,DocScan,DocBold>"/*" {
outDoc->docify(yytext);
}
<DocCode,DocEmphasis,DocBold>"\n" { outDoc->writeChar('\n'); }
<DocScan>({B}*"\n"){2,}{B}*"*"*{B}*"-"("#")?{B}+ { // new paragraph & start of a list
QCString text=yytext;
int dashPos = text.findRev('-');
bool isEnumerated = text.at(dashPos+1)=='#';
if (insideArgumentList)
{
insideArgumentList=FALSE;
outDoc->endItemList();
}
else if (insideItemList)
{
forceEndItemList();
}
else
{
outDoc->newParagraph();
}
if (inBlock()) endBlock();
addListItemMarker(strrchr(yytext,'\n')+1,dashPos,isEnumerated);
}
<DocScan>({B}*"\n"){2,}{B}* { // new paragraph
if (insideArgumentList)
{
insideArgumentList=FALSE;
outDoc->endItemList();
}
else if (insideItemList)
{
forceEndItemList();
}
else
{
outDoc->newParagraph();
}
if (inBlock()) endBlock();
}
<DocScan>{BN}+/\n {
outDoc->writeChar(' ');
}
<DocScan>\n?{B}* {
outDoc->writeChar(' ');
}
<DocCode,DocEmphasis,DocBold,DocScan,Text>[a-z_A-Z0-9]+ {
outDoc->docify(yytext);
}
<DocCode,DocEmphasis,DocBold,DocScan,Text>. {
outDoc->writeChar(*yytext);
}
<*>\n { yyLineNr++ ; }
<*>.
%%
//----------------------------------------------------------------------------
void scanString(const char *s)
{
const char *oldInputString = inputString;
int oldInputPosition = inputPosition;
int oldRule = YY_START;
YY_BUFFER_STATE oldBuffer = YY_CURRENT_BUFFER;
yy_switch_to_buffer(yy_create_buffer(docYYin, YY_BUF_SIZE));
inputString = s;
inputPosition = 0;
BEGIN( Text );
docYYlex();
yy_delete_buffer(YY_CURRENT_BUFFER);
yy_switch_to_buffer(oldBuffer);
inputString = oldInputString;
inputPosition = oldInputPosition;
BEGIN( oldRule );
}
void internalParseDocument(const char *s)
{
const char *oldInputString = inputString;
int oldInputPosition = inputPosition;
int oldRule = YY_START;
YY_BUFFER_STATE oldBuffer = YY_CURRENT_BUFFER;
yy_switch_to_buffer(yy_create_buffer(docYYin, YY_BUF_SIZE));
inputString = s;
inputPosition = 0;
BEGIN( DocScan );
docYYlex();
yy_delete_buffer(YY_CURRENT_BUFFER);
yy_switch_to_buffer(oldBuffer);
inputString = oldInputString;
inputPosition = oldInputPosition;
BEGIN( oldRule );
}
//----------------------------------------------------------------------------
void parseDocument(OutputList &ol,const QCString &docString)
{
//inParamBlock=inSeeBlock=inReturnBlock=FALSE;
curTable = 0;
depthIf = 0;
outDoc = new OutputList(&ol);
currentIncludeFile.resize(0);
includeFileOffset=0;
includeFileLength=0;
currentListIndent.clear();
if (!docString) return;
linkRef = "";
linkText = "";
inputString = docString;
inputPosition = 0;
docYYrestart( docYYin );
BEGIN( DocScan );
insideArgumentList = FALSE;
insideVerbatim = FALSE;
docYYlex();
if (insideArgumentList) { insideArgumentList=FALSE; outDoc->endItemList(); }
if (insideItemList) { forceEndItemList(); }
if (inBlock()) endBlock();
if (!currentListIndent.isEmpty())
{
warn(yyFileName,yyLineNr,"Warning: Documentation ended in the middle "
"of a list!");
warn_cont("Missing: ");
while (!currentListIndent.isEmpty())
{
char c;
switch((c=*currentListIndent.pop()))
{
case 'O': warn_cont("</ol>"); break;
case 'U': warn_cont("</ul>"); break;
case 'D': warn_cont("</dl>"); break;
}
}
warn_cont("\n");
}
if (depthIf!=0)
{
warn(yyFileName,yyLineNr,"Warning: Documentation block contains \\if "
"without matching \\endif: nesting level is %d",depthIf);
}
if (!tableStack.isEmpty())
{
forceEndTable();
}
if (insideVerbatim)
{
warn(yyFileName,yyLineNr,
"Warning: file ended inside a \\verbatim block!"
);
}
ol+=*outDoc;
delete outDoc; outDoc=0;
return;
}
//----------------------------------------------------------------------------
void parseDoc(OutputList &ol,const char *fileName,int startLine,
const char *clName,const char *memName,const QCString &docString)
{
//printf("parseDoc(file=`%s',line=%d)\n",fileName,startLine);
initParser();
initParseCodeContext();
exampleDoc=FALSE; // do not cross reference with member docs
className=clName;
memberName=memName;
strcpy(yyFileName,fileName);
yyLineNr = startLine;
parseDocument(ol,docString);
}
//----------------------------------------------------------------------------
void parseText(OutputList &ol,const QCString &txtString)
{
if (txtString.isEmpty()) return;
inputString = txtString;
outDoc = new OutputList(&ol);
inputPosition = 0;
docYYrestart( docYYin );
BEGIN( Text );
docYYlex();
ol+=*outDoc;
delete outDoc; outDoc=0;
return;
}
//----------------------------------------------------------------------------
void parseExample(OutputList &ol,const QCString &docString,
const char *fileName)
{
initParser();
initParseCodeContext();
exampleDoc=TRUE; // cross reference with member docs
exampleName=fileName;
strcpy(yyFileName,fileName);
parseDocument(ol,docString);
}
//----------------------------------------------------------------------------
extern "C" { // some bogus code to keep the compiler happy
void docYYdummy() { yy_flex_realloc(0,0); }
}
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "version.h" #include "version.h"
#include "doxygen.h" #include "doxygen.h"
#include "scanner.h" #include "scanner.h"
#include "doc.h"
#include "entry.h" #include "entry.h"
#include "index.h" #include "index.h"
#include "logos.h" #include "logos.h"
...@@ -172,74 +173,123 @@ const char *getOverloadDocs() ...@@ -172,74 +173,123 @@ const char *getOverloadDocs()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static void addTodoItem(Entry *root,const char *prefix, static void addRelatedPage(const char *name,const QCString &ptitle,
const char *name,const char *title=0) const QCString &doc,QList<QCString> *anchors,
const char *fileName,int startLine,
int todoId,int testId
)
{ {
//printf("addTodoItem(%s) todoId=%d\n",name,root->todoId); PageInfo *pi=0;
if (root->todoId==0 || !Config::generateTodoList) return; if ((pi=pageDict[name]))
RefItem *item = todoList.getRefItem(root->todoId); {
ASSERT(item!=0); //warn("Warning: Page %s was already documented. Ignoring documentation "
if (item->written) return; // "at line %d of %s\n",root->name.data(),root->startLine,
// root->fileName.data());
Entry *page = new Entry;
page->section = Entry::PAGEDOC_SEC; // append documentation block to the page.
page->fileName = "generated"; pi->doc+="\n\n"+doc;
page->startLine = 1; }
page->name = "todo";
page->args = theTranslator->trTodoList();
page->doc += "<dl><dt>\\anchor ";
page->doc += item->listAnchor;
page->doc += "\n";
page->doc += prefix;
page->doc += " \\ref ";
page->doc += name;
page->doc += " \"";
if (title && title[0]!='\0')
page->doc += title;
else else
page->doc += name; {
page->doc += "\":</dt>\n<dd>"; QCString baseName=name;
page->doc += item->text; if (baseName.right(4)==".tex")
page->doc += "</dd></dl>\n"; baseName=baseName.left(baseName.length()-4);
root->addSubEntry(page); else if (baseName.right(5)==".html")
baseName=baseName.left(baseName.length()-5);
item->written=TRUE; QCString title=ptitle.stripWhiteSpace();
pi=new PageInfo(fileName,startLine,baseName,doc,title);
pi->todoId=todoId;
pi->testId=testId;
QCString pageName;
if (Config::caseSensitiveNames)
pageName=pi->name.copy();
else
pageName=pi->name.lower();
setFileNameForSections(anchors,pageName);
pageList.append(pi);
pageDict.insert(baseName,pi);
if (!pi->title.isEmpty())
{
//outputList->writeTitle(pi->name,pi->title);
// a page name is a label as well!
SectionInfo *si=new SectionInfo(
pi->name,pi->title,SectionInfo::Section);
si->fileName=pageName;
//printf(" SectionInfo: sec=%p sec->fileName=%s\n",si,si->fileName.data());
//printf("Adding section info %s\n",pi->name.data());
sectionDict.insert(pageName,si);
}
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static void addTestItem(Entry *root,const char *prefix, static void addRefItem(int todoId,int testId,const char *prefix,
const char *name,const char *title=0) const char *name,const char *title,const char *args=0)
{ {
//printf("addTestItem(%s) testId=%d\n",name,root->testId);
if (root->testId==0 || !Config::generateTestList) return;
RefItem *item = testList.getRefItem(root->testId);
ASSERT(item!=0);
if (item->written) return;
Entry *page = new Entry;
page->section = Entry::PAGEDOC_SEC;
page->fileName = "generated";
page->startLine = 1;
page->name = "test";
page->args = theTranslator->trTestList();
page->doc += "<dl><dt>\\anchor ";
page->doc += item->listAnchor;
page->doc += "\n";
page->doc += prefix;
page->doc += " \\ref ";
page->doc += name;
page->doc += " \"";
if (title && title[0]!='\0')
page->doc += title;
else
page->doc += name;
page->doc += "\":</dt>\n<dd>";
page->doc += item->text;
page->doc += "</dd></dl>\n";
root->addSubEntry(page);
item->written=TRUE; //printf("addRefItem(%s) todoId=%d testId\n",name,todoId,testId);
////////////////////////////////////////////////////////////
// add item to the todo list
////////////////////////////////////////////////////////////
if (todoId>0 && Config::generateTodoList)
{
RefItem *item = todoList.getRefItem(todoId);
ASSERT(item!=0);
if (item->written) return;
QCString doc;
doc += "<dl><dt>\\anchor ";
doc += item->listAnchor;
doc += "\n";
doc += prefix;
doc += " \\_internalref ";
doc += name;
doc += " \"";
doc += title;
doc += "\"";
if (args) doc += args;
doc += "</dt>\n<dd>";
doc += item->text;
doc += "</dd></dl>\n";
addRelatedPage("todo",theTranslator->trTodoList(),doc,0,"generated",1,0,0);
item->written=TRUE;
}
////////////////////////////////////////////////////////////
// add item to the test list
////////////////////////////////////////////////////////////
if (testId>0 && Config::generateTestList)
{
RefItem *item = testList.getRefItem(testId);
ASSERT(item!=0);
if (item->written) return;
QCString doc;
doc += "<dl><dt>\\anchor ";
doc += item->listAnchor;
doc += "\n";
doc += prefix;
doc += " \\_internalref ";
doc += name;
doc += " \"";
doc += title;
doc += "\"";
if (args) doc += args;
doc += "</dt>\n<dd>";
doc += item->text;
doc += "</dd></dl>\n";
addRelatedPage("test",theTranslator->trTestList(),doc,0,"generated",1,0,0);
item->written=TRUE;
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
...@@ -269,8 +319,7 @@ static void buildGroupList(Entry *root) ...@@ -269,8 +319,7 @@ static void buildGroupList(Entry *root)
groupList.append(gd); groupList.append(gd);
groupDict.insert(root->name,gd); groupDict.insert(root->name,gd);
addGroupToGroups(root,gd); addGroupToGroups(root,gd);
addTodoItem(root,"group",gd->name()); gd->setRefItems(root->todoId,root->testId);
addTestItem(root,"group",gd->name());
} }
} }
EntryListIterator eli(*root->sublist); EntryListIterator eli(*root->sublist);
...@@ -343,6 +392,7 @@ static void buildFileList(Entry *root) ...@@ -343,6 +392,7 @@ static void buildFileList(Entry *root)
fd->setDocumentation(root->doc,FALSE); fd->setDocumentation(root->doc,FALSE);
fd->setBriefDescription(root->brief); fd->setBriefDescription(root->brief);
fd->addSectionsToDefinition(root->anchors); fd->addSectionsToDefinition(root->anchors);
fd->setRefItems(root->todoId,root->testId);
QListIterator<QCString> sli(*root->groups); QListIterator<QCString> sli(*root->groups);
QCString *s; QCString *s;
for (;(s=sli.current());++sli) for (;(s=sli.current());++sli)
...@@ -354,8 +404,6 @@ static void buildFileList(Entry *root) ...@@ -354,8 +404,6 @@ static void buildFileList(Entry *root)
//printf("File %s: in group %s\n",fd->name().data(),s->data()); //printf("File %s: in group %s\n",fd->name().data(),s->data());
} }
} }
addTodoItem(root,"file",fd->name());
addTestItem(root,"file",fd->name());
} }
} }
else else
...@@ -585,8 +633,7 @@ static void buildClassList(Entry *root) ...@@ -585,8 +633,7 @@ static void buildClassList(Entry *root)
fd->insertClass(cd); fd->insertClass(cd);
} }
addClassToGroups(root,cd); addClassToGroups(root,cd);
addTodoItem(root,"class",cd->name()); cd->setRefItems(root->todoId,root->testId);
addTestItem(root,"class",cd->name());
if (!root->subGrouping) cd->setSubGrouping(FALSE); if (!root->subGrouping) cd->setSubGrouping(FALSE);
} }
else // new class else // new class
...@@ -627,8 +674,7 @@ static void buildClassList(Entry *root) ...@@ -627,8 +674,7 @@ static void buildClassList(Entry *root)
if (!root->subGrouping) cd->setSubGrouping(FALSE); if (!root->subGrouping) cd->setSubGrouping(FALSE);
addClassToGroups(root,cd); addClassToGroups(root,cd);
addTodoItem(root,"class",cd->name()); cd->setRefItems(root->todoId,root->testId);
addTestItem(root,"class",cd->name());
// see if the class is found inside a namespace // see if the class is found inside a namespace
bool found=addNamespace(root,cd); bool found=addNamespace(root,cd);
...@@ -740,8 +786,7 @@ static void buildNamespaceList(Entry *root) ...@@ -740,8 +786,7 @@ static void buildNamespaceList(Entry *root)
// insert the namespace in the file definition // insert the namespace in the file definition
if (fd) fd->insertNamespace(nd); if (fd) fd->insertNamespace(nd);
addNamespaceToGroups(root,nd); addNamespaceToGroups(root,nd);
addTodoItem(root,"namespace",nd->name()); nd->setRefItems(root->todoId,root->testId);
addTestItem(root,"namespace",nd->name());
} }
else /* if (!root->doc.isEmpty() || else /* if (!root->doc.isEmpty() ||
!root->brief.isEmpty() || !root->brief.isEmpty() ||
...@@ -756,8 +801,7 @@ static void buildNamespaceList(Entry *root) ...@@ -756,8 +801,7 @@ static void buildNamespaceList(Entry *root)
//printf("Adding namespace to group\n"); //printf("Adding namespace to group\n");
addNamespaceToGroups(root,nd); addNamespaceToGroups(root,nd);
addTodoItem(root,"namespace",nd->name()); nd->setRefItems(root->todoId,root->testId);
addTestItem(root,"namespace",nd->name());
bool ambig; bool ambig;
// file definition containing the namespace nd // file definition containing the namespace nd
...@@ -880,8 +924,7 @@ static void findUsingDirectives(Entry *root) ...@@ -880,8 +924,7 @@ static void findUsingDirectives(Entry *root)
// add class to the list // add class to the list
namespaceList.inSort(nd); namespaceList.inSort(nd);
namespaceDict.insert(root->name,nd); namespaceDict.insert(root->name,nd);
addTodoItem(root,"namespace",nd->name()); nd->setRefItems(root->todoId,root->testId);
addTestItem(root,"namespace",nd->name());
} }
} }
} }
...@@ -1082,20 +1125,19 @@ static MemberDef *addVariableToClass( ...@@ -1082,20 +1125,19 @@ static MemberDef *addVariableToClass(
// add the member to the global list // add the member to the global list
if (mn) if (mn)
{ {
mn->inSort(md); mn->append(md);
} }
else // new variable name else // new variable name
{ {
mn = new MemberName(name); mn = new MemberName(name);
mn->inSort(md); mn->append(md);
//printf("Adding memberName=%s\n",mn->memberName()); //printf("Adding memberName=%s\n",mn->memberName());
memberNameDict.insert(name,mn); memberNameDict.insert(name,mn);
memberNameList.inSort(mn); memberNameList.inSort(mn);
// add the member to the class // add the member to the class
} }
cd->insertMember(md); cd->insertMember(md);
addTodoItem(root,"member",cd->name()+"::"+md->name()); md->setRefItems(root->todoId,root->testId);
addTestItem(root,"member",cd->name()+"::"+md->name());
//TODO: insert FileDef instead of filename strings. //TODO: insert FileDef instead of filename strings.
cd->insertUsedFile(root->fileName); cd->insertUsedFile(root->fileName);
...@@ -1123,6 +1165,9 @@ static MemberDef *addVariableToFile( ...@@ -1123,6 +1165,9 @@ static MemberDef *addVariableToFile(
root->protection root->protection
); );
bool ambig;
FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig);
// see if the function is inside a namespace // see if the function is inside a namespace
NamespaceDef *nd = 0; NamespaceDef *nd = 0;
if (!scope.isEmpty()) if (!scope.isEmpty())
...@@ -1181,16 +1226,7 @@ static MemberDef *addVariableToFile( ...@@ -1181,16 +1226,7 @@ static MemberDef *addVariableToFile(
// variable already in the scope // variable already in the scope
{ {
addMemberDocs(root,md,def,0,FALSE); addMemberDocs(root,md,def,0,FALSE);
if (nscope.isEmpty()) md->setRefItems(root->todoId,root->testId);
{
addTodoItem(root,"member",md->name());
addTestItem(root,"member",md->name());
}
else
{
addTodoItem(root,"member",nscope+"::"+md->name());
addTestItem(root,"member",nscope+"::"+md->name());
}
return md; return md;
} }
md=mn->next(); md=mn->next();
...@@ -1214,8 +1250,6 @@ static MemberDef *addVariableToFile( ...@@ -1214,8 +1250,6 @@ static MemberDef *addVariableToFile(
md->setInitializer(root->initializer); md->setInitializer(root->initializer);
md->setMaxInitLines(root->initLines); md->setMaxInitLines(root->initLines);
md->setMemberGroupId(root->mGrpId); md->setMemberGroupId(root->mGrpId);
bool ambig;
FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig);
md->setBodyDef(fd); md->setBodyDef(fd);
md->setDefinition(def); md->setDefinition(def);
//if (root->mGrpId!=-1) //if (root->mGrpId!=-1)
...@@ -1223,12 +1257,11 @@ static MemberDef *addVariableToFile( ...@@ -1223,12 +1257,11 @@ static MemberDef *addVariableToFile(
// md->setMemberGroup(memberGroupDict[root->mGrpId]); // md->setMemberGroup(memberGroupDict[root->mGrpId]);
//} //}
md->setRefItems(root->todoId,root->testId);
if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@')
{ {
nd->insertMember(md); nd->insertMember(md);
md->setNamespace(nd); md->setNamespace(nd);
addTodoItem(root,"member",nd->name()+"::"+md->name());
addTestItem(root,"member",nd->name()+"::"+md->name());
} }
else else
{ {
...@@ -1237,20 +1270,18 @@ static MemberDef *addVariableToFile( ...@@ -1237,20 +1270,18 @@ static MemberDef *addVariableToFile(
{ {
fd->insertMember(md); fd->insertMember(md);
md->setFileDef(fd); md->setFileDef(fd);
addTodoItem(root,"member",md->name());
addTestItem(root,"member",md->name());
} }
} }
// add member definition to the list of globals // add member definition to the list of globals
if (mn) if (mn)
{ {
mn->inSort(md); mn->append(md);
} }
else else
{ {
mn = new MemberName(name); mn = new MemberName(name);
mn->inSort(md); mn->append(md);
functionNameDict.insert(name,mn); functionNameDict.insert(name,mn);
functionNameList.inSort(mn); functionNameList.inSort(mn);
} }
...@@ -1617,12 +1648,12 @@ static void buildMemberList(Entry *root) ...@@ -1617,12 +1648,12 @@ static void buildMemberList(Entry *root)
MemberName *mn; MemberName *mn;
if ((mn=memberNameDict[name])) if ((mn=memberNameDict[name]))
{ {
mn->inSort(md); mn->append(md);
} }
else else
{ {
mn = new MemberName(name); mn = new MemberName(name);
mn->inSort(md); mn->append(md);
//printf("Adding memberName=%s\n",mn->memberName()); //printf("Adding memberName=%s\n",mn->memberName());
memberNameDict.insert(name,mn); memberNameDict.insert(name,mn);
memberNameList.inSort(mn); memberNameList.inSort(mn);
...@@ -1632,8 +1663,6 @@ static void buildMemberList(Entry *root) ...@@ -1632,8 +1663,6 @@ static void buildMemberList(Entry *root)
cd->insertMember(md); cd->insertMember(md);
// add file to list of used files // add file to list of used files
cd->insertUsedFile(root->fileName); cd->insertUsedFile(root->fileName);
addTodoItem(root,"member",cd->name()+"::"+md->name());
addTestItem(root,"member",cd->name()+"::"+md->name());
addMemberToGroups(root,md); addMemberToGroups(root,md);
} }
...@@ -1790,8 +1819,7 @@ static void buildMemberList(Entry *root) ...@@ -1790,8 +1819,7 @@ static void buildMemberList(Entry *root)
{ {
nd->insertMember(md); nd->insertMember(md);
md->setNamespace(nd); md->setNamespace(nd);
addTodoItem(root,"member",nd->name()+"::"+md->name()); md->setRefItems(root->todoId,root->testId);
addTestItem(root,"member",nd->name()+"::"+md->name());
} }
else else
{ {
...@@ -1806,8 +1834,7 @@ static void buildMemberList(Entry *root) ...@@ -1806,8 +1834,7 @@ static void buildMemberList(Entry *root)
// add member to the file // add member to the file
fd->insertMember(md); fd->insertMember(md);
md->setFileDef(fd); md->setFileDef(fd);
addTodoItem(root,"member",md->name()); md->setRefItems(root->todoId,root->testId);
addTestItem(root,"member",md->name());
} }
} }
...@@ -1815,12 +1842,12 @@ static void buildMemberList(Entry *root) ...@@ -1815,12 +1842,12 @@ static void buildMemberList(Entry *root)
MemberName *mn; MemberName *mn;
if ((mn=functionNameDict[name])) if ((mn=functionNameDict[name]))
{ {
mn->inSort(md); mn->append(md);
} }
else else
{ {
mn = new MemberName(name); mn = new MemberName(name);
mn->inSort(md); mn->append(md);
functionNameDict.insert(name,mn); functionNameDict.insert(name,mn);
functionNameList.inSort(mn); functionNameList.inSort(mn);
} }
...@@ -2274,6 +2301,84 @@ static void computeMemberReferences() ...@@ -2274,6 +2301,84 @@ static void computeMemberReferences()
} }
} }
//----------------------------------------------------------------------
static void addTodoTestReferences()
{
ClassDef *cd=classList.first();
while (cd)
{
addRefItem(cd->todoId(),cd->testId(),"class",cd->getOutputFileBase(),cd->name());
cd=classList.next();
}
FileName *fn=inputNameList.first();
while (fn)
{
FileDef *fd=fn->first();
while (fd)
{
addRefItem(fd->todoId(),fd->testId(),"file",fd->getOutputFileBase(),fd->name());
fd=fn->next();
}
fn=inputNameList.next();
}
NamespaceDef *nd=namespaceList.first();
while (nd)
{
addRefItem(nd->todoId(),nd->testId(),"namespace",nd->getOutputFileBase(),nd->name());
nd=namespaceList.next();
}
GroupDef *gd=groupList.first();
while (gd)
{
addRefItem(gd->todoId(),gd->testId(),"group",gd->getOutputFileBase(),gd->name());
gd=groupList.next();
}
PageInfo *pi=pageList.first();
while (pi)
{
addRefItem(pi->todoId,pi->testId,"page",pi->name,pi->title);
pi=pageList.next();
}
MemberNameListIterator mnli(memberNameList);
MemberName *mn=0;
for (mnli.toFirst();(mn=mnli.current());++mnli)
{
MemberNameIterator mni(*mn);
MemberDef *md=0;
for (mni.toFirst();(md=mni.current());++mni)
{
Definition *d=md->getClassDef();
QCString scopeName;
if (d) scopeName=d->name();
if (d==0) d=md->getFileDef();
if (d==0) d=md->getGroupDef();
if (d)
{
addRefItem(md->todoId(),md->testId(),"member",d->getOutputFileBase()+":"+md->anchor(),scopeName+"::"+md->name(),md->argsString());
}
}
}
MemberNameListIterator fnli(functionNameList);
for (fnli.toFirst();(mn=fnli.current());++fnli)
{
MemberNameIterator mni(*mn);
MemberDef *md=0;
for (mni.toFirst();(md=mni.current());++mni)
{
Definition *d=md->getNamespaceDef();
QCString scopeName;
if (d) scopeName=d->name();
if (d==0) d=md->getBodyDef();
if (d==0) d=md->getGroupDef();
if (d)
{
addRefItem(md->todoId(),md->testId(),"member",d->getOutputFileBase()+":"+md->anchor(),scopeName+"::"+md->name(),md->argsString());
}
}
}
}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
...@@ -2327,8 +2432,6 @@ static void addMemberDocs(Entry *root, ...@@ -2327,8 +2432,6 @@ static void addMemberDocs(Entry *root,
doc+=root->doc; doc+=root->doc;
} }
md->setDocumentation(doc); md->setDocumentation(doc);
addTodoItem(root,"member",fullName);
addTestItem(root,"member",fullName);
} }
else else
{ {
...@@ -2367,17 +2470,20 @@ static void addMemberDocs(Entry *root, ...@@ -2367,17 +2470,20 @@ static void addMemberDocs(Entry *root,
//{ //{
// md->setBody(root->body); // md->setBody(root->body);
//} //}
if ((md->getStartBodyLine()==-1 && root->bodyLine!=-1) || bool ambig;
(md->isVariable() && !root->explicitExternal)) FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig);
if (fd)
{ {
md->setBodySegment(root->bodyLine,root->endBodyLine);
bool ambig;
FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig);
md->setBodyDef(fd);
}
addTodoItem(root,"member",fullName); if ((md->getStartBodyLine()==-1 && root->bodyLine!=-1) ||
addTestItem(root,"member",fullName); (md->isVariable() && !root->explicitExternal))
{
md->setBodySegment(root->bodyLine,root->endBodyLine);
md->setBodyDef(fd);
}
md->setRefItems(root->todoId,root->testId);
}
} }
//md->setDefFile(root->fileName); //md->setDefFile(root->fileName);
...@@ -3250,11 +3356,10 @@ static void findMember(Entry *root,QCString funcDecl,QCString related,bool overl ...@@ -3250,11 +3356,10 @@ static void findMember(Entry *root,QCString funcDecl,QCString related,bool overl
md->setBodyDef(fd); md->setBodyDef(fd);
md->setMemberSpecifiers(root->memSpec); md->setMemberSpecifiers(root->memSpec);
md->setMemberGroupId(root->mGrpId); md->setMemberGroupId(root->mGrpId);
mn->inSort(md); mn->append(md);
cd->insertMember(md); cd->insertMember(md);
cd->insertUsedFile(root->fileName); cd->insertUsedFile(root->fileName);
addTodoItem(root,"member",cd->name()+"::"+md->name()); md->setRefItems(root->todoId,root->testId);
addTestItem(root,"member",cd->name()+"::"+md->name());
} }
} }
else // unrelated function with the same name as a member else // unrelated function with the same name as a member
...@@ -3368,11 +3473,10 @@ static void findMember(Entry *root,QCString funcDecl,QCString related,bool overl ...@@ -3368,11 +3473,10 @@ static void findMember(Entry *root,QCString funcDecl,QCString related,bool overl
md->setBriefDescription(root->brief); md->setBriefDescription(root->brief);
md->addSectionsToDefinition(root->anchors); md->addSectionsToDefinition(root->anchors);
md->setMemberGroupId(root->mGrpId); md->setMemberGroupId(root->mGrpId);
mn->inSort(md); mn->append(md);
cd->insertMember(md); cd->insertMember(md);
cd->insertUsedFile(root->fileName); cd->insertUsedFile(root->fileName);
addTodoItem(root,"member",cd->name()+"::"+md->name()); md->setRefItems(root->todoId,root->testId);
addTestItem(root,"member",cd->name()+"::"+md->name());
if (newMemberName) if (newMemberName)
{ {
//printf("Adding memberName=%s\n",mn->memberName()); //printf("Adding memberName=%s\n",mn->memberName());
...@@ -3596,6 +3700,7 @@ static void findEnums(Entry *root) ...@@ -3596,6 +3700,7 @@ static void findEnums(Entry *root)
//{ //{
// md->setMemberGroup(memberGroupDict[root->mGrpId]); // md->setMemberGroup(memberGroupDict[root->mGrpId]);
//} //}
md->setRefItems(root->todoId,root->testId);
if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@')
{ {
if (Config::hideScopeNames) if (Config::hideScopeNames)
...@@ -3608,15 +3713,11 @@ static void findEnums(Entry *root) ...@@ -3608,15 +3713,11 @@ static void findEnums(Entry *root)
} }
nd->insertMember(md); nd->insertMember(md);
md->setNamespace(nd); md->setNamespace(nd);
addTodoItem(root,"member",nd->name()+"::"+md->name());
addTestItem(root,"member",nd->name()+"::"+md->name());
} }
else if (isGlobal) else if (isGlobal)
{ {
md->setDefinition(name); md->setDefinition(name);
fd->insertMember(md); fd->insertMember(md);
addTodoItem(root,"member",md->name());
addTestItem(root,"member",md->name());
} }
else if (cd) else if (cd)
{ {
...@@ -3630,8 +3731,6 @@ static void findEnums(Entry *root) ...@@ -3630,8 +3731,6 @@ static void findEnums(Entry *root)
} }
cd->insertMember(md); cd->insertMember(md);
cd->insertUsedFile(root->fileName); cd->insertUsedFile(root->fileName);
addTodoItem(root,"member",cd->name()+"::"+md->name());
addTestItem(root,"member",cd->name()+"::"+md->name());
} }
md->setDocumentation(root->doc); md->setDocumentation(root->doc);
md->setBriefDescription(root->brief); md->setBriefDescription(root->brief);
...@@ -3640,12 +3739,12 @@ static void findEnums(Entry *root) ...@@ -3640,12 +3739,12 @@ static void findEnums(Entry *root)
if ((mn=(*mnd)[name])) if ((mn=(*mnd)[name]))
{ {
// this is used if the same enum is in multiple namespaces/classes // this is used if the same enum is in multiple namespaces/classes
mn->inSort(md); mn->append(md);
} }
else // new enum name else // new enum name
{ {
mn = new MemberName(name); mn = new MemberName(name);
mn->inSort(md); mn->append(md);
mnd->insert(name,mn); mnd->insert(name,mn);
mnl->inSort(mn); mnl->inSort(mn);
//printf("add %s to new memberName. Now %d members\n", //printf("add %s to new memberName. Now %d members\n",
...@@ -3925,31 +4024,6 @@ static void computeClassImplUsageRelations() ...@@ -3925,31 +4024,6 @@ static void computeClassImplUsageRelations()
} }
} }
//----------------------------------------------------------------------------
//static void computeMemberGroups()
//{
// ClassDef *cd;
// ClassListIterator cli(classList);
// for (;(cd=cli.current());++cli)
// {
// cd->computeMemberGroups();
// }
//}
//----------------------------------------------------------------------------
#if 0
void computeClassIntfUsageRelations()
{
ClassDef *cd;
ClassListIterator cli(classList);
for (;(cd=cli.current());++cli)
{
cd->determineIntfUsageRelation();
}
}
#endif
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// builds the list of all members for each class // builds the list of all members for each class
...@@ -4356,8 +4430,6 @@ static void findDefineDocumentation(Entry *root) ...@@ -4356,8 +4430,6 @@ static void findDefineDocumentation(Entry *root)
} }
} }
//----------------------------------------------------------------------------
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// create a (sorted) list of separate documentation pages // create a (sorted) list of separate documentation pages
...@@ -4367,59 +4439,16 @@ static void buildPageList(Entry *root) ...@@ -4367,59 +4439,16 @@ static void buildPageList(Entry *root)
{ {
if (!root->name.isEmpty()) if (!root->name.isEmpty())
{ {
PageInfo *pi=0; addRelatedPage(root->name,root->args,root->doc,root->anchors,
if ((pi=pageDict[root->name])) root->fileName,root->startLine,root->todoId,root->testId
{ );
//warn("Warning: Page %s was already documented. Ignoring documentation "
// "at line %d of %s\n",root->name.data(),root->startLine,
// root->fileName.data());
// append documentation block to the page.
pi->doc+="\n\n"+root->doc;
}
else
{
QCString baseName=root->name.copy();
if (baseName.right(4)==".tex")
baseName=baseName.left(baseName.length()-4);
else if (baseName.right(5)==".html")
baseName=baseName.left(baseName.length()-5);
QCString title=root->args.stripWhiteSpace();
pi=new PageInfo(root->fileName,root->startLine,
baseName, root->doc,title);
QCString pageName;
if (Config::caseSensitiveNames)
pageName=pi->name.copy();
else
pageName=pi->name.lower();
setFileNameForSections(root->anchors,pageName);
addTodoItem(root,"page",pageName,title);
addTestItem(root,"page",pageName,title);
pageList.append(pi);
pageDict.insert(baseName,pi);
if (!pi->title.isEmpty())
{
//outputList->writeTitle(pi->name,pi->title);
// a page name is a label as well!
SectionInfo *si=new SectionInfo(
pi->name,pi->title,SectionInfo::Section);
si->fileName=pageName;
//printf(" SectionInfo: sec=%p sec->fileName=%s\n",si,si->fileName.data());
//printf("Adding section info %s\n",pi->name.data());
sectionDict.insert(pageName,si);
}
}
} }
} }
else if (root->section == Entry::MAINPAGEDOC_SEC) else if (root->section == Entry::MAINPAGEDOC_SEC)
{ {
QCString title=root->args.stripWhiteSpace(); QCString title=root->args.stripWhiteSpace();
if (title.isEmpty()) title=theTranslator->trMainPage(); if (title.isEmpty()) title=theTranslator->trMainPage();
addTodoItem(root,"page","index",title); addRefItem(root->todoId,root->testId,"page","index",title);
addTestItem(root,"page","index",title);
} }
EntryListIterator eli(*root->sublist); EntryListIterator eli(*root->sublist);
Entry *e; Entry *e;
...@@ -4628,34 +4657,6 @@ static void generateGroupDocs() ...@@ -4628,34 +4657,6 @@ static void generateGroupDocs()
} }
} }
//----------------------------------------------------------------------------
// create member group documentation based on the documentation of the
// group's members.
//void computeMemberGroupDocumentation()
//{
// MemberGroupDictIterator mgdi(memberGroupDict);
// MemberGroup *mg;
// for (;(mg=mgdi.current());++mgdi)
// {
// mg->addDocumentation();
// }
//}
//----------------------------------------------------------------------------
// generate member group pages
//void generateMemberGroupDocs()
//{
// MemberGroupDictIterator mgdi(memberGroupDict);
// MemberGroup *mg;
// for (;(mg=mgdi.current());++mgdi)
// {
// mg->writeDocumentation(*outputList);
// }
//}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// generate module pages // generate module pages
...@@ -5404,7 +5405,7 @@ int main(int argc,char **argv) ...@@ -5404,7 +5405,7 @@ int main(int argc,char **argv)
{ {
QCString configFile=fileToString(argv[optind+4]); QCString configFile=fileToString(argv[optind+4]);
if (configFile.isEmpty()) exit(1); if (configFile.isEmpty()) exit(1);
parseConfig(fileToString(argv[optind+4])); parseConfig(fileToString(argv[optind+4]),argv[optind+4]);
configStrToVal(); configStrToVal();
substituteEnvironmentVars(); substituteEnvironmentVars();
checkConfig(); checkConfig();
...@@ -5442,7 +5443,7 @@ int main(int argc,char **argv) ...@@ -5442,7 +5443,7 @@ int main(int argc,char **argv)
{ {
QCString configFile=fileToString(argv[optind+3]); QCString configFile=fileToString(argv[optind+3]);
if (configFile.isEmpty()) exit(1); if (configFile.isEmpty()) exit(1);
parseConfig(fileToString(argv[optind+3])); parseConfig(fileToString(argv[optind+3]),argv[optind+3]);
configStrToVal(); configStrToVal();
substituteEnvironmentVars(); substituteEnvironmentVars();
checkConfig(); checkConfig();
...@@ -5542,7 +5543,7 @@ int main(int argc,char **argv) ...@@ -5542,7 +5543,7 @@ int main(int argc,char **argv)
} }
} }
parseConfig(config); parseConfig(config,configName);
configStrToVal(); configStrToVal();
if (updateConfig) if (updateConfig)
...@@ -5838,6 +5839,9 @@ int main(int argc,char **argv) ...@@ -5838,6 +5839,9 @@ int main(int argc,char **argv)
msg("Adding source references...\n"); msg("Adding source references...\n");
addSourceReferences(); addSourceReferences();
msg("Adding todo/test references...\n");
addTodoTestReferences();
/************************************************************************** /**************************************************************************
* Generate documentation * * Generate documentation *
...@@ -5917,7 +5921,6 @@ int main(int argc,char **argv) ...@@ -5917,7 +5921,6 @@ int main(int argc,char **argv)
generateSearchIndex(); generateSearchIndex();
msg("Generating style sheet...\n"); msg("Generating style sheet...\n");
//outputList->enable(OutputGenerator::Latex);
outputList->writeStyleInfo(0); // write first part outputList->writeStyleInfo(0); // write first part
outputList->disableAllBut(OutputGenerator::Latex); outputList->disableAllBut(OutputGenerator::Latex);
parseText(*outputList, parseText(*outputList,
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "classlist.h" #include "classlist.h"
#include "membername.h" #include "membername.h"
#include "filename.h" #include "filename.h"
//#include "define.h"
#include "namespacedef.h" #include "namespacedef.h"
#include "formula.h" #include "formula.h"
#include "section.h" #include "section.h"
...@@ -37,7 +36,8 @@ ...@@ -37,7 +36,8 @@
struct PageInfo struct PageInfo
{ {
PageInfo(const char *f, int l,const char *n,const char *d,const char *t) : PageInfo(const char *f, int l,const char *n,const char *d,const char *t) :
defFileName(f), defLine(l), name(n), doc(d), title(t) {} defFileName(f), defLine(l), name(n), doc(d), title(t),
todoId(0), testId(0) {}
// where the page definition was found // where the page definition was found
QCString defFileName; QCString defFileName;
...@@ -47,6 +47,10 @@ struct PageInfo ...@@ -47,6 +47,10 @@ struct PageInfo
QCString name; QCString name;
QCString doc; QCString doc;
QCString title; QCString title;
// ids
int todoId;
int testId;
}; };
class PageList : public QList<PageInfo> class PageList : public QList<PageInfo>
...@@ -104,7 +108,6 @@ extern MemberNameDict functionNameDict; ...@@ -104,7 +108,6 @@ extern MemberNameDict functionNameDict;
extern StringDict substituteDict; extern StringDict substituteDict;
extern FileList fileList; extern FileList fileList;
extern FileDict fileDict; extern FileDict fileDict;
//extern DefineDict defineDict;
extern ClassDef unrelatedClass; extern ClassDef unrelatedClass;
extern QTextStream tagFile; extern QTextStream tagFile;
extern SectionDict sectionDict; extern SectionDict sectionDict;
...@@ -113,7 +116,6 @@ extern FileNameDict *includeNameDict; ...@@ -113,7 +116,6 @@ extern FileNameDict *includeNameDict;
extern FileNameDict *exampleNameDict; extern FileNameDict *exampleNameDict;
extern FileNameDict *inputNameDict; extern FileNameDict *inputNameDict;
extern FileNameDict *imageNameDict; extern FileNameDict *imageNameDict;
//extern FileList includeFiles;
extern StringDict typedefDict; extern StringDict typedefDict;
extern GroupList groupList; extern GroupList groupList;
extern GroupDict groupDict; extern GroupDict groupDict;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
TEMPLATE = doxygen.t TEMPLATE = doxygen.t
CONFIG = console qt warn_on $extraopts CONFIG = console qt warn_on $extraopts
HEADERS = doxygen.h scanner.h classdef.h classlist.h memberdef.h \ HEADERS = doxygen.h scanner.h doc.h classdef.h classlist.h memberdef.h \
membername.h index.h memberlist.h definition.h \ membername.h index.h memberlist.h definition.h \
entry.h logos.h instdox.h message.h code.h \ entry.h logos.h instdox.h message.h code.h \
filedef.h util.h cppvalue.h constexp.h \ filedef.h util.h cppvalue.h constexp.h \
...@@ -27,8 +27,8 @@ HEADERS = doxygen.h scanner.h classdef.h classlist.h memberdef.h \ ...@@ -27,8 +27,8 @@ HEADERS = doxygen.h scanner.h classdef.h classlist.h memberdef.h \
translator_it.h formula.h debug.h membergroup.h htmlhelp.h \ translator_it.h formula.h debug.h membergroup.h htmlhelp.h \
translator_ru.h translator_pl.h dot.h rtfgen.h xml.h xml_dtd.h \ translator_ru.h translator_pl.h dot.h rtfgen.h xml.h xml_dtd.h \
reflist.h reflist.h
SOURCES = doxygen.cpp scanner.cpp classdef.cpp classlist.cpp memberdef.cpp \ SOURCES = doxygen.cpp scanner.cpp doc.cpp classdef.cpp classlist.cpp \
membername.cpp index.cpp memberlist.cpp \ memberdef.cpp membername.cpp index.cpp memberlist.cpp \
entry.cpp logos.cpp instdox.cpp message.cpp code.cpp \ entry.cpp logos.cpp instdox.cpp message.cpp code.cpp \
config.cpp filedef.cpp util.cpp groupdef.cpp \ config.cpp filedef.cpp util.cpp groupdef.cpp \
outputgen.cpp outputlist.cpp htmlgen.cpp latexgen.cpp mangen.cpp \ outputgen.cpp outputlist.cpp htmlgen.cpp latexgen.cpp mangen.cpp \
......
...@@ -65,6 +65,9 @@ sub GenerateDep { ...@@ -65,6 +65,9 @@ sub GenerateDep {
#$ GenerateDep("defargs.cpp","defargs.l"); #$ GenerateDep("defargs.cpp","defargs.l");
$(LEX) -PdefargsYY -t defargs.l >defargs.cpp $(LEX) -PdefargsYY -t defargs.l >defargs.cpp
#$ GenerateDep("doc.cpp","doc.l");
$(LEX) -PdocYY -t doc.l >doc.cpp
#$ GenerateDep("ce_lex.cpp","constexp.l","ce_parse.h"); #$ GenerateDep("ce_lex.cpp","constexp.l","ce_parse.h");
$(LEX) -PcppExpYY -t constexp.l >ce_lex.cpp $(LEX) -PcppExpYY -t constexp.l >ce_lex.cpp
...@@ -77,3 +80,4 @@ sub GenerateDep { ...@@ -77,3 +80,4 @@ sub GenerateDep {
xml_dtd.h: doxygen.dtd xml_dtd.h: doxygen.dtd
cat doxygen.dtd | sed -e "s/\"/\\\\\"/g" -e "s/^/\"/g" -e "s/$$/\\\\n\"/g" >xml_dtd.h cat doxygen.dtd | sed -e "s/\"/\\\\\"/g" -e "s/^/\"/g" -e "s/$$/\\\\n\"/g" >xml_dtd.h
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "memberlist.h" #include "memberlist.h"
#include "classlist.h" #include "classlist.h"
#include "filedef.h" #include "filedef.h"
#include "scanner.h" #include "doc.h"
#include "doxygen.h" #include "doxygen.h"
#include "memberdef.h" #include "memberdef.h"
#include "classdef.h" #include "classdef.h"
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include "outputlist.h" #include "outputlist.h"
#include "dot.h" #include "dot.h"
#include "message.h" #include "message.h"
#include "code.h"
#include "xml.h"
/*! create a new file definition, where \a p is the file path, /*! create a new file definition, where \a p is the file path,
\a the file name, and \a ref is an HTML anchor name if the \a the file name, and \a ref is an HTML anchor name if the
...@@ -355,7 +357,7 @@ void FileDef::writeDocumentation(OutputList &ol) ...@@ -355,7 +357,7 @@ void FileDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trDefineDocumentation()); parseText(ol,theTranslator->trDefineDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
defineMembers.writeDocumentation(ol,name()); defineMembers.writeDocumentation(ol,name(),this);
} }
protoMembers.countDocMembers(); protoMembers.countDocMembers();
...@@ -365,7 +367,7 @@ void FileDef::writeDocumentation(OutputList &ol) ...@@ -365,7 +367,7 @@ void FileDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trFunctionPrototypeDocumentation()); parseText(ol,theTranslator->trFunctionPrototypeDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
protoMembers.writeDocumentation(ol,name()); protoMembers.writeDocumentation(ol,name(),this);
} }
typedefMembers.countDocMembers(); typedefMembers.countDocMembers();
...@@ -375,7 +377,7 @@ void FileDef::writeDocumentation(OutputList &ol) ...@@ -375,7 +377,7 @@ void FileDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trTypedefDocumentation()); parseText(ol,theTranslator->trTypedefDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
typedefMembers.writeDocumentation(ol,name()); typedefMembers.writeDocumentation(ol,name(),this);
} }
enumMembers.countDocMembers(); enumMembers.countDocMembers();
...@@ -385,7 +387,7 @@ void FileDef::writeDocumentation(OutputList &ol) ...@@ -385,7 +387,7 @@ void FileDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trEnumerationTypeDocumentation()); parseText(ol,theTranslator->trEnumerationTypeDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
enumMembers.writeDocumentation(ol,name()); enumMembers.writeDocumentation(ol,name(),this);
} }
funcMembers.countDocMembers(); funcMembers.countDocMembers();
...@@ -395,7 +397,7 @@ void FileDef::writeDocumentation(OutputList &ol) ...@@ -395,7 +397,7 @@ void FileDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trFunctionDocumentation()); parseText(ol,theTranslator->trFunctionDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
funcMembers.writeDocumentation(ol,name()); funcMembers.writeDocumentation(ol,name(),this);
} }
varMembers.countDocMembers(); varMembers.countDocMembers();
...@@ -405,7 +407,7 @@ void FileDef::writeDocumentation(OutputList &ol) ...@@ -405,7 +407,7 @@ void FileDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trVariableDocumentation()); parseText(ol,theTranslator->trVariableDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
varMembers.writeDocumentation(ol,name()); varMembers.writeDocumentation(ol,name(),this);
} }
// write Author section (Man only) // write Author section (Man only)
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "filedef.h" #include "filedef.h"
#include "classlist.h" #include "classlist.h"
#include "outputlist.h" #include "outputlist.h"
#include "scanner.h" #include "doc.h"
#include "namespacedef.h" #include "namespacedef.h"
#include "language.h" #include "language.h"
#include "util.h" #include "util.h"
...@@ -373,7 +373,7 @@ void GroupDef::writeDocumentation(OutputList &ol) ...@@ -373,7 +373,7 @@ void GroupDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trDefineDocumentation()); parseText(ol,theTranslator->trDefineDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
defineMembers.writeDocumentation(ol,name()); defineMembers.writeDocumentation(ol,name(),this);
} }
protoMembers.countDocMembers(); protoMembers.countDocMembers();
...@@ -383,7 +383,7 @@ void GroupDef::writeDocumentation(OutputList &ol) ...@@ -383,7 +383,7 @@ void GroupDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trFunctionPrototypeDocumentation()); parseText(ol,theTranslator->trFunctionPrototypeDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
protoMembers.writeDocumentation(ol,name()); protoMembers.writeDocumentation(ol,name(),this);
} }
typedefMembers.countDocMembers(); typedefMembers.countDocMembers();
...@@ -393,7 +393,7 @@ void GroupDef::writeDocumentation(OutputList &ol) ...@@ -393,7 +393,7 @@ void GroupDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trTypedefDocumentation()); parseText(ol,theTranslator->trTypedefDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
typedefMembers.writeDocumentation(ol,name()); typedefMembers.writeDocumentation(ol,name(),this);
} }
enumMembers.countDocMembers(); enumMembers.countDocMembers();
...@@ -403,7 +403,7 @@ void GroupDef::writeDocumentation(OutputList &ol) ...@@ -403,7 +403,7 @@ void GroupDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trEnumerationTypeDocumentation()); parseText(ol,theTranslator->trEnumerationTypeDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
enumMembers.writeDocumentation(ol,name()); enumMembers.writeDocumentation(ol,name(),this);
} }
//enumValMembers.countDocMembers(); //enumValMembers.countDocMembers();
...@@ -423,7 +423,7 @@ void GroupDef::writeDocumentation(OutputList &ol) ...@@ -423,7 +423,7 @@ void GroupDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trFunctionDocumentation()); parseText(ol,theTranslator->trFunctionDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
funcMembers.writeDocumentation(ol,name()); funcMembers.writeDocumentation(ol,name(),this);
} }
varMembers.countDocMembers(); varMembers.countDocMembers();
...@@ -433,7 +433,7 @@ void GroupDef::writeDocumentation(OutputList &ol) ...@@ -433,7 +433,7 @@ void GroupDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trVariableDocumentation()); parseText(ol,theTranslator->trVariableDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
varMembers.writeDocumentation(ol,name()); varMembers.writeDocumentation(ol,name(),this);
} }
endFile(ol); endFile(ol);
......
...@@ -277,13 +277,13 @@ void HtmlGenerator::writeStyleInfo(int part) ...@@ -277,13 +277,13 @@ void HtmlGenerator::writeStyleInfo(int part)
} }
} }
void HtmlGenerator::startDoxyAnchor(const char *,const char *, void HtmlGenerator::startDoxyAnchor(const char *,
const char *anchor, const char *name) const char *anchor, const char *name)
{ {
t << "<a name=\"" << anchor << "\" doxytag=\"" << name << "\"></a>"; t << "<a name=\"" << anchor << "\" doxytag=\"" << name << "\"></a>";
} }
void HtmlGenerator::endDoxyAnchor() void HtmlGenerator::endDoxyAnchor(const char *,const char *)
{ {
} }
...@@ -789,12 +789,11 @@ void HtmlGenerator::endAlphabeticalIndexList() ...@@ -789,12 +789,11 @@ void HtmlGenerator::endAlphabeticalIndexList()
void HtmlGenerator::writeIndexHeading(const char *s) void HtmlGenerator::writeIndexHeading(const char *s)
{ {
//t << "<dt><b><big>" << s << "</big></b><dd>" << endl;
t << "<div class=\"ah\"><font color=\"white\"><b>&nbsp;&nbsp;" << s t << "<div class=\"ah\"><font color=\"white\"><b>&nbsp;&nbsp;" << s
<< "&nbsp;&nbsp;</b></font></div>"; << "&nbsp;&nbsp;</b></font></div>";
} }
void HtmlGenerator::writeImage(const char *name,const char *,const char *) void HtmlGenerator::startImage(const char *name,const char *,bool hasCaption)
{ {
QCString baseName=name; QCString baseName=name;
int i; int i;
...@@ -802,7 +801,21 @@ void HtmlGenerator::writeImage(const char *name,const char *,const char *) ...@@ -802,7 +801,21 @@ void HtmlGenerator::writeImage(const char *name,const char *,const char *)
{ {
baseName=baseName.right(baseName.length()-i-1); baseName=baseName.right(baseName.length()-i-1);
} }
t << "<div align=\"center\">" << endl;
t << "<img src=\"" << name << "\" alt=\"" << baseName << "\">" << endl; t << "<img src=\"" << name << "\" alt=\"" << baseName << "\">" << endl;
if (hasCaption)
{
t << "<p><strong>";
}
}
void HtmlGenerator::endImage(bool hasCaption)
{
if (hasCaption)
{
t << "</strong></p>" << endl;
}
t << "</div>" << endl;
} }
void HtmlGenerator::startMemberDoc(const char *,const char *,const char *,const char *) void HtmlGenerator::startMemberDoc(const char *,const char *,const char *,const char *)
......
...@@ -142,9 +142,8 @@ class HtmlGenerator : public OutputGenerator ...@@ -142,9 +142,8 @@ class HtmlGenerator : public OutputGenerator
void endMemberDoc(); void endMemberDoc();
//void writeDoxyAnchor(const char *fName,const char *clName, //void writeDoxyAnchor(const char *fName,const char *clName,
// const char *anchor,const char *name); // const char *anchor,const char *name);
void startDoxyAnchor(const char *fName,const char *clName, void startDoxyAnchor(const char *fName,const char *anchor,const char *name);
const char *anchor,const char *name); void endDoxyAnchor(const char *fName,const char *anchor);
void endDoxyAnchor();
void startCodeAnchor(const char *label) { t << "<a name=\"" << label << "\"></a>"; } void startCodeAnchor(const char *label) { t << "<a name=\"" << label << "\"></a>"; }
void endCodeAnchor() { } void endCodeAnchor() { }
void writeLatexSpacing() {} void writeLatexSpacing() {}
...@@ -201,7 +200,8 @@ class HtmlGenerator : public OutputGenerator ...@@ -201,7 +200,8 @@ class HtmlGenerator : public OutputGenerator
void endQuickIndexItem(); void endQuickIndexItem();
void writeFormula(const char *,const char *); void writeFormula(const char *,const char *);
void writeNonBreakableSpace() { t << "&nbsp;&nbsp;&nbsp;"; } void writeNonBreakableSpace() { t << "&nbsp;&nbsp;&nbsp;"; }
void writeImage(const char *,const char *,const char *); void startImage(const char *,const char *,bool);
void endImage(bool);
void startDescTable() void startDescTable()
{ t << "<table border=0 cellspacing=2 cellpadding=0>" << endl; } { t << "<table border=0 cellspacing=2 cellpadding=0>" << endl; }
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "message.h" #include "message.h"
#include "index.h" #include "index.h"
#include "doxygen.h" #include "doxygen.h"
#include "scanner.h" #include "doc.h"
#include "code.h" #include "code.h"
#include "config.h" #include "config.h"
#include "filedef.h" #include "filedef.h"
...@@ -634,7 +634,7 @@ void writeNamespaceIndex(OutputList &ol) ...@@ -634,7 +634,7 @@ void writeNamespaceIndex(OutputList &ol)
ol.endEmphasis(); ol.endEmphasis();
} }
ol.docify(")"); ol.docify(")");
ol.writeEndAnnoItem(nd->name()); ol.writeEndAnnoItem(nd->getOutputFileBase());
if (hasHtmlHelp) if (hasHtmlHelp)
{ {
htmlHelp->addContentsItem(nd->name(),nd->getOutputFileBase()); htmlHelp->addContentsItem(nd->name(),nd->getOutputFileBase());
...@@ -710,7 +710,7 @@ void writeAnnotatedClassList(OutputList &ol) ...@@ -710,7 +710,7 @@ void writeAnnotatedClassList(OutputList &ol)
ol.endEmphasis(); ol.endEmphasis();
} }
ol.docify(")"); ol.docify(")");
ol.writeEndAnnoItem(cd->name()); ol.writeEndAnnoItem(cd->getOutputFileBase());
if (Config::generateHtml && Config::htmlHelpFlag) if (Config::generateHtml && Config::htmlHelpFlag)
{ {
HtmlHelp::getInstance()->addContentsItem( HtmlHelp::getInstance()->addContentsItem(
...@@ -1521,7 +1521,11 @@ void writeGraphInfo(OutputList &ol) ...@@ -1521,7 +1521,11 @@ void writeGraphInfo(OutputList &ol)
startTitle(ol,0); startTitle(ol,0);
parseText(ol,theTranslator->trLegendTitle()); parseText(ol,theTranslator->trLegendTitle());
endTitle(ol,0,0); endTitle(ol,0,0);
bool oldStripCommentsState = Config::stripCommentsFlag;
// temporarily disable the stripping of comments for our own code example!
Config::stripCommentsFlag = FALSE;
parseDoc(ol,"graph_legend",1,0,0,theTranslator->trLegendDocs()); parseDoc(ol,"graph_legend",1,0,0,theTranslator->trLegendDocs());
Config::stripCommentsFlag = oldStripCommentsState;
endFile(ol); endFile(ol);
ol.popGeneratorState(); ol.popGeneratorState();
} }
......
...@@ -800,7 +800,7 @@ void LatexGenerator::writeIndexItem(const char *ref,const char *fn, ...@@ -800,7 +800,7 @@ void LatexGenerator::writeIndexItem(const char *ref,const char *fn,
{ {
t << "\\contentsline{section}{"; t << "\\contentsline{section}{";
docify(name); docify(name);
t << "}{\\pageref{" << name << "}}{}" << endl; t << "}{\\pageref{" << fn << "}}{}" << endl;
} }
else else
docify(name); docify(name);
...@@ -871,14 +871,15 @@ void LatexGenerator::startTextLink(const char *f,const char *anchor) ...@@ -871,14 +871,15 @@ void LatexGenerator::startTextLink(const char *f,const char *anchor)
if (anchor) t << "_" << anchor; if (anchor) t << "_" << anchor;
t << "}{"; t << "}{";
} }
else
{
t << "{\\bf ";
}
} }
void LatexGenerator::endTextLink() void LatexGenerator::endTextLink()
{ {
if (Config::pdfHyperFlag) t << "}";
{
t << "}";
}
} }
void LatexGenerator::writeObjectLink(const char *ref, const char *f, void LatexGenerator::writeObjectLink(const char *ref, const char *f,
...@@ -936,7 +937,7 @@ void LatexGenerator::endTitleHead(const char *fileName,const char *name) ...@@ -936,7 +937,7 @@ void LatexGenerator::endTitleHead(const char *fileName,const char *name)
t << "}" << endl; t << "}" << endl;
if (name) if (name)
{ {
t << "\\label{" << name << "}\\index{" t << "\\label{" << fileName << "}\\index{"
<< name << "@{"; << name << "@{";
docify(name); docify(name);
t << "}}" << endl; t << "}}" << endl;
...@@ -1012,13 +1013,9 @@ void LatexGenerator::endMemberDoc() ...@@ -1012,13 +1013,9 @@ void LatexGenerator::endMemberDoc()
if (Config::compactLatexFlag) t << "\\hfill"; if (Config::compactLatexFlag) t << "\\hfill";
} }
void LatexGenerator::startDoxyAnchor(const char *fName,const char *clname, void LatexGenerator::startDoxyAnchor(const char *fName,const char *anchor,
const char *anchor,const char *) const char *)
{ {
t << "\\label{";
if (clname) t << clname;
if (anchor) t << "_" << anchor;
t << "}" << endl;
if (Config::pdfHyperFlag) if (Config::pdfHyperFlag)
{ {
t << "\\hypertarget{"; t << "\\hypertarget{";
...@@ -1028,12 +1025,16 @@ void LatexGenerator::startDoxyAnchor(const char *fName,const char *clname, ...@@ -1028,12 +1025,16 @@ void LatexGenerator::startDoxyAnchor(const char *fName,const char *clname,
} }
} }
void LatexGenerator::endDoxyAnchor() void LatexGenerator::endDoxyAnchor(const char *fName,const char *anchor)
{ {
if (Config::pdfHyperFlag) if (Config::pdfHyperFlag)
{ {
t << "}" << endl; t << "}" << endl;
} }
t << "\\label{";
if (fName) t << fName;
if (anchor) t << "_" << anchor;
t << "}" << endl;
} }
void LatexGenerator::writeAnchor(const char *fName,const char *name) void LatexGenerator::writeAnchor(const char *fName,const char *name)
...@@ -1406,20 +1407,34 @@ void LatexGenerator::endMemberList() ...@@ -1406,20 +1407,34 @@ void LatexGenerator::endMemberList()
t << "\\end{CompactItemize}" << endl; t << "\\end{CompactItemize}" << endl;
} }
void LatexGenerator::writeImage(const char *name,const char *w,const char *h) void LatexGenerator::startImage(const char *name,const char *size,bool hasCaption)
{ {
t << "\\mbox{"; if (hasCaption)
t << "\\begin{figure}[H]" << endl;
else
t << "\\mbox{";
QCString gfxName = name; QCString gfxName = name;
if (gfxName.right(4)==".eps") gfxName.left(gfxName.length()-4); if (gfxName.right(4)==".eps") gfxName.left(gfxName.length()-4);
// "\\epsfig{file=" << name; // "\\epsfig{file=" << name;
t << "\\includegraphics"; t << "\\includegraphics";
if (w || h) t << "["; if (size) t << "[" << size << "]";
if (w) t << "width=" << w; else if (h) t << "height=" << h;
if (w || h) t << "]";
t << "{" << gfxName << "}"; t << "{" << gfxName << "}";
t << "}" << endl; if (hasCaption)
t << "\\caption{";
else
t << "}" << endl;
} }
void LatexGenerator::endImage(bool hasCaption)
{
if (hasCaption)
{
t << "}" << endl;
t << "\\end{figure}" << endl;
}
}
void LatexGenerator::startMemberGroupHeader(bool hasHeader) void LatexGenerator::startMemberGroupHeader(bool hasHeader)
{ {
if (hasHeader) t << "\\begin{Indent}"; if (hasHeader) t << "\\begin{Indent}";
......
...@@ -125,8 +125,8 @@ class LatexGenerator : public OutputGenerator ...@@ -125,8 +125,8 @@ class LatexGenerator : public OutputGenerator
void lineBreak() { t << "\\par\n"; } void lineBreak() { t << "\\par\n"; }
void startMemberDoc(const char *,const char *,const char *,const char *); void startMemberDoc(const char *,const char *,const char *,const char *);
void endMemberDoc(); void endMemberDoc();
void startDoxyAnchor(const char *,const char *,const char *,const char *); void startDoxyAnchor(const char *,const char *,const char *);
void endDoxyAnchor(); void endDoxyAnchor(const char *,const char *);
void startCodeAnchor(const char *) {} void startCodeAnchor(const char *) {}
void endCodeAnchor() {} void endCodeAnchor() {}
void writeChar(char c); void writeChar(char c);
...@@ -197,7 +197,8 @@ class LatexGenerator : public OutputGenerator ...@@ -197,7 +197,8 @@ class LatexGenerator : public OutputGenerator
void endQuickIndexItem() {} void endQuickIndexItem() {}
void writeFormula(const char *,const char *); void writeFormula(const char *,const char *);
void writeNonBreakableSpace(); void writeNonBreakableSpace();
void writeImage(const char *,const char *,const char *); void startImage(const char *,const char *,bool);
void endImage(bool);
void startDescTable() void startDescTable()
{ t << "\\begin{description}" << endl; } { t << "\\begin{description}" << endl; }
......
...@@ -122,9 +122,8 @@ class ManGenerator : public OutputGenerator ...@@ -122,9 +122,8 @@ class ManGenerator : public OutputGenerator
void writeChar(char c); void writeChar(char c);
void startMemberDoc(const char *,const char *,const char *,const char *); void startMemberDoc(const char *,const char *,const char *,const char *);
void endMemberDoc() {} void endMemberDoc() {}
void startDoxyAnchor(const char *,const char *, void startDoxyAnchor(const char *,const char *,const char *) {}
const char *,const char *) {} void endDoxyAnchor(const char *,const char *) {}
void endDoxyAnchor() {}
void startCodeAnchor(const char *) {} void startCodeAnchor(const char *) {}
void endCodeAnchor() {} void endCodeAnchor() {}
void writeLatexSpacing() {} void writeLatexSpacing() {}
...@@ -188,7 +187,8 @@ class ManGenerator : public OutputGenerator ...@@ -188,7 +187,8 @@ class ManGenerator : public OutputGenerator
void endQuickIndexItem() {} void endQuickIndexItem() {}
void writeFormula(const char *,const char *) {} void writeFormula(const char *,const char *) {}
void writeNonBreakableSpace() { t << " "; } void writeNonBreakableSpace() { t << " "; }
void writeImage(const char *,const char *,const char *) {} void startImage(const char *,const char *,bool) {}
void endImage(bool) {}
void startDescTable() {} void startDescTable() {}
void endDescTable() {} void endDescTable() {}
......
...@@ -21,13 +21,14 @@ ...@@ -21,13 +21,14 @@
#include "membername.h" #include "membername.h"
#include "doxygen.h" #include "doxygen.h"
#include "util.h" #include "util.h"
#include "code.h"
#include "message.h" #include "message.h"
#include "htmlhelp.h" #include "htmlhelp.h"
#include "language.h" #include "language.h"
#include "outputlist.h" #include "outputlist.h"
#include "example.h" #include "example.h"
#include "membergroup.h" #include "membergroup.h"
#include "scanner.h" #include "doc.h"
#include "groupdef.h" #include "groupdef.h"
#include "defargs.h" #include "defargs.h"
#include "xml.h" #include "xml.h"
...@@ -583,7 +584,7 @@ void MemberDef::writeDeclaration(OutputList &ol, ...@@ -583,7 +584,7 @@ void MemberDef::writeDeclaration(OutputList &ol,
{ {
QCString doxyName=name().copy(); QCString doxyName=name().copy();
if (!cname.isEmpty()) doxyName.prepend(cname+"::"); if (!cname.isEmpty()) doxyName.prepend(cname+"::");
ol.startDoxyAnchor(cfname,cname,anchor(),doxyName); ol.startDoxyAnchor(cfname,anchor(),doxyName);
ol.addToIndex(name(),cname); ol.addToIndex(name(),cname);
ol.addToIndex(cname,name()); ol.addToIndex(cname,name());
if (hasHtmlHelp) if (hasHtmlHelp)
...@@ -763,7 +764,7 @@ void MemberDef::writeDeclaration(OutputList &ol, ...@@ -763,7 +764,7 @@ void MemberDef::writeDeclaration(OutputList &ol,
if (!detailsVisible && !Config::extractAllFlag && !annMemb) if (!detailsVisible && !Config::extractAllFlag && !annMemb)
{ {
ol.endDoxyAnchor(); ol.endDoxyAnchor(cfname,anchor());
} }
ol.endMemberItem((annoClassDef!=0 && indDepth==0) || annEnumType); ol.endMemberItem((annoClassDef!=0 && indDepth==0) || annEnumType);
...@@ -796,7 +797,7 @@ void MemberDef::writeDeclaration(OutputList &ol, ...@@ -796,7 +797,7 @@ void MemberDef::writeDeclaration(OutputList &ol,
* all active output formats. * all active output formats.
*/ */
void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol,
const char *scopeName) const char *scopeName,Definition *container)
{ {
if (getClassDef()==0 && isStatic() && !Config::extractStaticFlag) return; if (getClassDef()==0 && isStatic() && !Config::extractStaticFlag) return;
bool hasDocs = detailsAreVisible(); bool hasDocs = detailsAreVisible();
...@@ -809,16 +810,9 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ...@@ -809,16 +810,9 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol,
(!hasDocs && !briefDescription().isEmpty() && annUsed) (!hasDocs && !briefDescription().isEmpty() && annUsed)
) )
{ {
// get definition. TODO: make a method of this // get definition.
NamespaceDef *nd=getNamespaceDef(); QCString cname = container->name();
ClassDef *cd=getClassDef(); QCString cfname = container->getOutputFileBase();
FileDef *fd=getFileDef();
Definition *d = 0;
if (cd) d=cd; else if (nd) d=nd; else d=fd;
ASSERT(d!=0);
QCString cname = d->name();
QCString cfname = d->getOutputFileBase();
// get member name // get member name
QCString doxyName=name().copy(); QCString doxyName=name().copy();
...@@ -858,7 +852,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ...@@ -858,7 +852,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol,
{ {
if (vmd->isEnumerate() && ldef.mid(i,l)==vmd->name()) if (vmd->isEnumerate() && ldef.mid(i,l)==vmd->name())
{ {
ol.startDoxyAnchor(cfname,cname,anchor(),doxyName); ol.startDoxyAnchor(cfname,anchor(),doxyName);
ol.startMemberDoc(cname,name(),anchor(),name()); ol.startMemberDoc(cname,name(),anchor(),name());
if (hasHtmlHelp) if (hasHtmlHelp)
{ {
...@@ -874,7 +868,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ...@@ -874,7 +868,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol,
if (!found) // anonymous compound if (!found) // anonymous compound
{ {
//printf("Annonymous compound `%s'\n",cname.data()); //printf("Annonymous compound `%s'\n",cname.data());
ol.startDoxyAnchor(cfname,cname,anchor(),doxyName); ol.startDoxyAnchor(cfname,anchor(),doxyName);
ol.startMemberDoc(cname,name(),anchor(),name()); ol.startMemberDoc(cname,name(),anchor(),name());
if (hasHtmlHelp) if (hasHtmlHelp)
{ {
...@@ -895,13 +889,14 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ...@@ -895,13 +889,14 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol,
} }
else else
{ {
ol.startDoxyAnchor(cfname,cname,anchor(),doxyName); ol.startDoxyAnchor(cfname,anchor(),doxyName);
ol.startMemberDoc(cname,name(),anchor(),name()); ol.startMemberDoc(cname,name(),anchor(),name());
if (hasHtmlHelp) if (hasHtmlHelp)
{ {
htmlHelp->addIndexItem(cname,name(),cfname,anchor()); htmlHelp->addIndexItem(cname,name(),cfname,anchor());
} }
ClassDef *cd=getClassDef();
ArgumentList *scopeAl=scopeDefTemplateArguments(); ArgumentList *scopeAl=scopeDefTemplateArguments();
if (scopeAl==0 && cd) scopeAl=cd->templateArguments(); if (scopeAl==0 && cd) scopeAl=cd->templateArguments();
...@@ -1016,7 +1011,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ...@@ -1016,7 +1011,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol,
} }
if (!isDefine()) ol.endParameter(TRUE); if (!isDefine()) ol.endParameter(TRUE);
ol.endMemberDoc(); ol.endMemberDoc();
ol.endDoxyAnchor(); ol.endDoxyAnchor(cfname,anchor());
ol.startIndent(); ol.startIndent();
ol.pushGeneratorState(); ol.pushGeneratorState();
...@@ -1121,7 +1116,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ...@@ -1121,7 +1116,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol,
} }
//ol.writeListItem(); //ol.writeListItem();
ol.startDescTableTitle(); ol.startDescTableTitle();
ol.startDoxyAnchor(cfname,cname,fmd->anchor(),fmd->name()); ol.startDoxyAnchor(cfname,fmd->anchor(),fmd->name());
first=FALSE; first=FALSE;
ol.startEmphasis(); ol.startEmphasis();
ol.docify(fmd->name()); ol.docify(fmd->name());
...@@ -1129,7 +1124,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ...@@ -1129,7 +1124,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol,
ol.disableAllBut(OutputGenerator::Man); ol.disableAllBut(OutputGenerator::Man);
ol.writeString(" "); ol.writeString(" ");
ol.enableAll(); ol.enableAll();
ol.endDoxyAnchor(); ol.endDoxyAnchor(cfname,fmd->anchor());
ol.endDescTableTitle(); ol.endDescTableTitle();
//ol.newParagraph(); //ol.newParagraph();
ol.startDescTableData(); ol.startDescTableData();
...@@ -1324,10 +1319,10 @@ void MemberDef::warnIfUndocumented() ...@@ -1324,10 +1319,10 @@ void MemberDef::warnIfUndocumented()
t="class", d=cd; t="class", d=cd;
else if (nd) else if (nd)
t="namespace", d=nd; t="namespace", d=nd;
else if (fd) else if (gd)
t="file", d=fd;
else
t="group", d=gd; t="group", d=gd;
else
t="file", d=fd;
if (d && d->isLinkable() && !isLinkable() && name().find('@')==-1) if (d && d->isLinkable() && !isLinkable() && name().find('@')==-1)
warn_undoc(defFileName,defLine,"Warning: Member %s of %s %s is not documented.", warn_undoc(defFileName,defLine,"Warning: Member %s of %s %s is not documented.",
...@@ -1570,3 +1565,20 @@ void MemberDef::generateXML(QTextStream &t,Definition *def) ...@@ -1570,3 +1565,20 @@ void MemberDef::generateXML(QTextStream &t,Definition *def)
t << ">" << endl; t << ">" << endl;
} }
Definition *MemberDef::getCompoundDef() const
{
NamespaceDef *nd=getNamespaceDef();
ClassDef *cd=getClassDef();
FileDef *fd=getFileDef();
GroupDef *gd=getGroupDef();
Definition *d = 0;
if (cd) d=cd; else if (nd) d=nd; else if (gd) d=gd; else d=fd;
ASSERT(d!=0);
return d;
}
QCString MemberDef::anchor() const
{
if (enumScope) return enumScope->anchor()+anc;
return anc;
}
...@@ -79,7 +79,7 @@ class MemberDef : public Definition ...@@ -79,7 +79,7 @@ class MemberDef : public Definition
const char *typeString() const { return type; } const char *typeString() const { return type; }
const char *argsString() const { return args; } const char *argsString() const { return args; }
const char *excpString() const { return exception; } const char *excpString() const { return exception; }
const char *anchor() const { return anc; } QCString anchor() const;
const QCString &initializer() const { return init; } const QCString &initializer() const { return init; }
int initializerLines() const { return initLines; } int initializerLines() const { return initLines; }
int getMemberSpecifiers() const { return memSpec; } int getMemberSpecifiers() const { return memSpec; }
...@@ -90,6 +90,7 @@ class MemberDef : public Definition ...@@ -90,6 +90,7 @@ class MemberDef : public Definition
GroupDef *getGroupDef() const { return group; } GroupDef *getGroupDef() const { return group; }
FileDef *getFileDef() const { return fileDef; } FileDef *getFileDef() const { return fileDef; }
NamespaceDef* getNamespaceDef() const { return nspace; } NamespaceDef* getNamespaceDef() const { return nspace; }
Definition *getCompoundDef() const;
// direct kind info // direct kind info
Protection protection() const { return prot; } Protection protection() const { return prot; }
...@@ -144,7 +145,7 @@ class MemberDef : public Definition ...@@ -144,7 +145,7 @@ class MemberDef : public Definition
ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
bool inGroup); bool inGroup);
void writeDocumentation(MemberList *ml,OutputList &ol, void writeDocumentation(MemberList *ml,OutputList &ol,
const char *scopeName/*,MemberType m*/); const char *scopeName,Definition *container);
void warnIfUndocumented(); void warnIfUndocumented();
// relation to other members // relation to other members
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "language.h" #include "language.h"
#include "doxygen.h" #include "doxygen.h"
#include "outputlist.h" #include "outputlist.h"
#include "scanner.h" #include "doc.h"
#include "groupdef.h" #include "groupdef.h"
MemberList::MemberList() : QList<MemberDef>() MemberList::MemberList() : QList<MemberDef>()
...@@ -583,13 +583,13 @@ void MemberList::writeDeclarations(OutputList &ol, ...@@ -583,13 +583,13 @@ void MemberList::writeDeclarations(OutputList &ol,
} }
void MemberList::writeDocumentation(OutputList &ol, void MemberList::writeDocumentation(OutputList &ol,
const char *scopeName/*, MemberDef::MemberType m*/) const char *scopeName, Definition *container)
{ {
MemberListIterator mli(*this); MemberListIterator mli(*this);
MemberDef *md; MemberDef *md;
for ( ; (md=mli.current()) ; ++mli) for ( ; (md=mli.current()) ; ++mli)
{ {
md->writeDocumentation(this,ol,scopeName); md->writeDocumentation(this,ol,scopeName,container);
} }
} }
......
...@@ -55,8 +55,8 @@ class MemberList : public QList<MemberDef> ...@@ -55,8 +55,8 @@ class MemberList : public QList<MemberDef>
ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
const char *title,const char *subtitle, const char *title,const char *subtitle,
bool inGroup=FALSE,bool countSubGroups=TRUE); bool inGroup=FALSE,bool countSubGroups=TRUE);
void writeDocumentation(OutputList &ol,const char *scopeName void writeDocumentation(OutputList &ol,const char *scopeName,
/*,MemberDef::MemberType m*/); Definition *container);
void addMemberGroup(MemberGroup *mg); void addMemberGroup(MemberGroup *mg);
private: private:
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "namespacedef.h" #include "namespacedef.h"
#include "outputlist.h" #include "outputlist.h"
#include "util.h" #include "util.h"
#include "scanner.h" #include "doc.h"
#include "language.h" #include "language.h"
#include "classdef.h" #include "classdef.h"
#include "classlist.h" #include "classlist.h"
...@@ -272,7 +272,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) ...@@ -272,7 +272,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trDefineDocumentation()); parseText(ol,theTranslator->trDefineDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
defineMembers.writeDocumentation(ol,name()); defineMembers.writeDocumentation(ol,name(),this);
} }
protoMembers.countDocMembers(); protoMembers.countDocMembers();
...@@ -282,7 +282,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) ...@@ -282,7 +282,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trFunctionPrototypeDocumentation()); parseText(ol,theTranslator->trFunctionPrototypeDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
protoMembers.writeDocumentation(ol,name()); protoMembers.writeDocumentation(ol,name(),this);
} }
typedefMembers.countDocMembers(); typedefMembers.countDocMembers();
...@@ -292,7 +292,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) ...@@ -292,7 +292,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trTypedefDocumentation()); parseText(ol,theTranslator->trTypedefDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
typedefMembers.writeDocumentation(ol,name()); typedefMembers.writeDocumentation(ol,name(),this);
} }
enumMembers.countDocMembers(); enumMembers.countDocMembers();
...@@ -302,7 +302,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) ...@@ -302,7 +302,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trEnumerationTypeDocumentation()); parseText(ol,theTranslator->trEnumerationTypeDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
enumMembers.writeDocumentation(ol,name()); enumMembers.writeDocumentation(ol,name(),this);
} }
//enumValMembers.countDocMembers(); //enumValMembers.countDocMembers();
...@@ -322,7 +322,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) ...@@ -322,7 +322,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trFunctionDocumentation()); parseText(ol,theTranslator->trFunctionDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
funcMembers.writeDocumentation(ol,name()); funcMembers.writeDocumentation(ol,name(),this);
} }
varMembers.countDocMembers(); varMembers.countDocMembers();
...@@ -332,7 +332,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) ...@@ -332,7 +332,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol)
ol.startGroupHeader(); ol.startGroupHeader();
parseText(ol,theTranslator->trVariableDocumentation()); parseText(ol,theTranslator->trVariableDocumentation());
ol.endGroupHeader(); ol.endGroupHeader();
varMembers.writeDocumentation(ol,name()); varMembers.writeDocumentation(ol,name(),this);
} }
// write Author section (Man only) // write Author section (Man only)
......
...@@ -122,9 +122,9 @@ class OutputGenerator ...@@ -122,9 +122,9 @@ class OutputGenerator
virtual void startMemberDoc(const char *,const char *, virtual void startMemberDoc(const char *,const char *,
const char *,const char *) = 0; const char *,const char *) = 0;
virtual void endMemberDoc() = 0; virtual void endMemberDoc() = 0;
virtual void startDoxyAnchor(const char *fileName,const char *clName, virtual void startDoxyAnchor(const char *fName,const char *anchor,
const char *anchor,const char *name) = 0; const char *name) = 0;
virtual void endDoxyAnchor() = 0; virtual void endDoxyAnchor(const char *fileName,const char *anchor) = 0;
virtual void startCodeAnchor(const char *label) = 0; virtual void startCodeAnchor(const char *label) = 0;
virtual void endCodeAnchor() = 0; virtual void endCodeAnchor() = 0;
virtual void writeLatexSpacing() = 0; virtual void writeLatexSpacing() = 0;
...@@ -187,7 +187,8 @@ class OutputGenerator ...@@ -187,7 +187,8 @@ class OutputGenerator
virtual void endQuickIndexItem() = 0; virtual void endQuickIndexItem() = 0;
virtual void writeFormula(const char *,const char *) = 0; virtual void writeFormula(const char *,const char *) = 0;
virtual void writeNonBreakableSpace() = 0; virtual void writeNonBreakableSpace() = 0;
virtual void writeImage(const char *,const char *,const char *) = 0; virtual void startImage(const char *,const char *,bool) = 0;
virtual void endImage(bool) = 0;
virtual void startDescTable() = 0; virtual void startDescTable() = 0;
virtual void endDescTable() = 0; virtual void endDescTable() = 0;
......
...@@ -203,11 +203,10 @@ class OutputList ...@@ -203,11 +203,10 @@ class OutputList
{ forall(&OutputGenerator::startMemberDoc,clName,memName,anchor,title); } { forall(&OutputGenerator::startMemberDoc,clName,memName,anchor,title); }
void endMemberDoc() void endMemberDoc()
{ forall(&OutputGenerator::endMemberDoc); } { forall(&OutputGenerator::endMemberDoc); }
void startDoxyAnchor(const char *fn, const char *cn, void startDoxyAnchor(const char *fName,const char *anchor, const char *name)
const char *anchor,const char *name) { forall(&OutputGenerator::startDoxyAnchor,fName,anchor,name); }
{ forall(&OutputGenerator::startDoxyAnchor,fn,cn,anchor,name); } void endDoxyAnchor(const char *fn,const char *anchor)
void endDoxyAnchor() { forall(&OutputGenerator::endDoxyAnchor,fn,anchor); }
{ forall(&OutputGenerator::endDoxyAnchor); }
void startCodeAnchor(const char *label) void startCodeAnchor(const char *label)
{ forall(&OutputGenerator::startCodeAnchor,label); } { forall(&OutputGenerator::startCodeAnchor,label); }
void endCodeAnchor() void endCodeAnchor()
...@@ -332,8 +331,10 @@ class OutputList ...@@ -332,8 +331,10 @@ class OutputList
{ forall(&OutputGenerator::writeFormula,n,t); } { forall(&OutputGenerator::writeFormula,n,t); }
void writeNonBreakableSpace() void writeNonBreakableSpace()
{ forall(&OutputGenerator::writeNonBreakableSpace); } { forall(&OutputGenerator::writeNonBreakableSpace); }
void writeImage(const char *n,const char *w,const char *h) void startImage(const char *n,const char *s,bool c)
{ forall(&OutputGenerator::writeImage,n,w,h); } { forall(&OutputGenerator::startImage,n,s,c); }
void endImage(bool c)
{ forall(&OutputGenerator::endImage,c); }
void startDescTable() void startDescTable()
{ forall(&OutputGenerator::startDescTable); } { forall(&OutputGenerator::startDescTable); }
......
...@@ -1124,7 +1124,7 @@ void RTFGenerator::writeIndexItem(const char *ref,const char *fn, ...@@ -1124,7 +1124,7 @@ void RTFGenerator::writeIndexItem(const char *ref,const char *fn,
if (!ref && fn) if (!ref && fn)
{ {
t << "\\tab "; t << "\\tab ";
WriteRTFReference(name); WriteRTFReference(fn);
t << endl; t << endl;
} }
else else
...@@ -1392,15 +1392,15 @@ void RTFGenerator::endTitleHead(const char *fileName,const char *name) ...@@ -1392,15 +1392,15 @@ void RTFGenerator::endTitleHead(const char *fileName,const char *name)
// make an index entry // make an index entry
addToIndex(name,0); addToIndex(name,0);
if (name) //if (name)
{ //{
writeAnchor(0,name); // writeAnchor(0,name);
} //}
//
if (Config::rtfHyperFlag && fileName) //if (Config::rtfHyperFlag && fileName)
{ //{
writeAnchor(fileName,0); writeAnchor(fileName,0);
} //}
} }
} }
...@@ -1459,13 +1459,16 @@ void RTFGenerator::endMemberDoc() ...@@ -1459,13 +1459,16 @@ void RTFGenerator::endMemberDoc()
newParagraph(); newParagraph();
} }
void RTFGenerator::startDoxyAnchor(const char *fName,const char *clname, void RTFGenerator::startDoxyAnchor(const char *,const char *,const char *)
const char *anchor,const char *) {
}
void RTFGenerator::endDoxyAnchor(const char *fName,const char *anchor)
{ {
QCString ref; QCString ref;
if (clname) if (fName)
{ {
ref+=clname; ref+=fName;
} }
if (anchor) if (anchor)
{ {
...@@ -1479,33 +1482,6 @@ void RTFGenerator::startDoxyAnchor(const char *fName,const char *clname, ...@@ -1479,33 +1482,6 @@ void RTFGenerator::startDoxyAnchor(const char *fName,const char *clname,
t << "{\\bkmkend "; t << "{\\bkmkend ";
t << formatBmkStr(ref); t << formatBmkStr(ref);
t << "}" << endl; t << "}" << endl;
if (Config::rtfHyperFlag)
{ // doxygen expects a bookmark based on fName for the hyper target so we make a second bookmark
ref="";
if (fName)
{
ref+=fName;
}
if (anchor)
{
ref+='_';
ref+=anchor;
}
t << "{\\bkmkstart ";
t << formatBmkStr(ref);
t << "}" << endl;
t << "{\\bkmkend ";
t << formatBmkStr(ref);
t << "}" << endl;
}
}
void RTFGenerator::endDoxyAnchor()
{
} }
...@@ -1760,12 +1736,9 @@ void RTFGenerator::endClassDiagram(ClassDiagram &d, ...@@ -1760,12 +1736,9 @@ void RTFGenerator::endClassDiagram(ClassDiagram &d,
const char *fileName,const char *) const char *fileName,const char *)
{ {
newParagraph(); newParagraph();
DBG_RTF(t <<"{\\comment This would be an image map..." << endl)
// create a gif file // create a gif file
d.writeImageMap(t,dir,fileName); d.writeImageMap(t,dir,fileName,FALSE);
t << "}" << endl;
// display the file // display the file
t << "{" << endl; t << "{" << endl;
...@@ -1855,16 +1828,14 @@ void RTFGenerator::endMemberList() ...@@ -1855,16 +1828,14 @@ void RTFGenerator::endMemberList()
#endif #endif
} }
void RTFGenerator::writeImage(const char *,const char *,const char *) void RTFGenerator::startImage(const char *,const char *,bool)
{ {
#ifdef DELETEDCODE // not yet implemented
t << "\\mbox{\\epsfig{file=" << name; }
if (w)
t << "," << w; void RTFGenerator::endImage(bool)
else if (h) {
t << "," << h; // not yet implemented
t << "}}" << endl;
#endif
} }
void RTFGenerator::startDescTable() void RTFGenerator::startDescTable()
......
...@@ -120,8 +120,8 @@ class RTFGenerator : public OutputGenerator ...@@ -120,8 +120,8 @@ class RTFGenerator : public OutputGenerator
void lineBreak(); void lineBreak();
void startMemberDoc(const char *,const char *,const char *,const char *); void startMemberDoc(const char *,const char *,const char *,const char *);
void endMemberDoc(); void endMemberDoc();
void startDoxyAnchor(const char *,const char *,const char *,const char *); void startDoxyAnchor(const char *,const char *,const char *);
void endDoxyAnchor(); void endDoxyAnchor(const char *,const char *);
void startCodeAnchor(const char *) {}; void startCodeAnchor(const char *) {};
void endCodeAnchor() {}; void endCodeAnchor() {};
void writeChar(char c); void writeChar(char c);
...@@ -183,7 +183,8 @@ class RTFGenerator : public OutputGenerator ...@@ -183,7 +183,8 @@ class RTFGenerator : public OutputGenerator
void endQuickIndexItem() {} void endQuickIndexItem() {}
void writeFormula(const char *,const char *); void writeFormula(const char *,const char *);
void writeNonBreakableSpace(); void writeNonBreakableSpace();
void writeImage(const char *,const char *,const char *); void startImage(const char *,const char *,bool);
void endImage(bool);
void startDescTable(); void startDescTable();
void endDescTable(); void endDescTable();
......
...@@ -19,22 +19,10 @@ ...@@ -19,22 +19,10 @@
#define SCANNER_H #define SCANNER_H
#include "qtbc.h" #include "qtbc.h"
#include <stdio.h>
#include <qlist.h>
#include <qintdict.h>
#include "entry.h"
#include "code.h"
class OutputList; class OutputList;
class Entry;
extern void parseMain(Entry *); extern void parseMain(Entry *);
extern void parseDoc(OutputList &ol,
const char *fileName,int startLine,
const char *clName, const char *memName,
const QCString &docString);
extern void parseExample(OutputList &ol,const QCString &docString,
const char *fileName);
extern void parseText(OutputList &ol,const QCString &txtString);
#endif #endif
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "outputlist.h" #include "outputlist.h"
#include "membergroup.h" #include "membergroup.h"
#include "reflist.h" #include "reflist.h"
#include "code.h"
#ifndef WIN32 #ifndef WIN32
#include <unistd.h> #include <unistd.h>
...@@ -54,14 +55,6 @@ ...@@ -54,14 +55,6 @@
* *
* statics * statics
*/ */
static bool insideArgumentList;
static QCString className;
static QCString memberName;
static OutputList * outDoc;
static QCString code;
static QCString linkRef;
static QCString linkText;
static QCString codeBlock;
static const char * inputString; static const char * inputString;
static int inputPosition; static int inputPosition;
static int lastContext; static int lastContext;
...@@ -113,38 +106,11 @@ static bool gstat; ...@@ -113,38 +106,11 @@ static bool gstat;
static bool removeSlashes; static bool removeSlashes;
static Specifier virt; static Specifier virt;
static Specifier baseVirt; static Specifier baseVirt;
static bool exampleDoc;
static QCString exampleName;
static QCString htmlUrl,htmlText;
static QCString currentIncludeFile;
static QCString msType,msName,msArgs; static QCString msType,msName,msArgs;
static int memberGroupId = NOGROUP; static int memberGroupId = NOGROUP;
static QCString memberGroupHeader; static QCString memberGroupHeader;
static QCString memberGroupDocs; static QCString memberGroupDocs;
static int includeFileOffset = 0;
static int includeFileLength = 0;
static bool firstLine;
static bool isTypedef; static bool isTypedef;
static bool inParamBlock;
static bool inRetValBlock;
static bool inExceptionBlock;
static bool inSeeBlock;
static bool inReturnBlock;
static bool inAuthorBlock;
static bool inDeprecatedBlock;
static bool inVersionBlock;
static bool inSinceBlock;
static bool inDateBlock;
static bool inBugBlock;
static bool inNoteBlock;
static bool inPreBlock;
static bool inPostBlock;
static bool inInvarBlock;
static bool inWarningBlock;
static bool inRemarkBlock;
static bool inAttentionBlock;
static bool inParBlock;
static bool firstSeeArg;
static char afterDocTerminator; static char afterDocTerminator;
static int tmpDocType; static int tmpDocType;
static QCString sectionLabel; static QCString sectionLabel;
...@@ -154,46 +120,32 @@ static SectionInfo::SectionType ...@@ -154,46 +120,32 @@ static SectionInfo::SectionType
static QCString funcPtrType; static QCString funcPtrType;
static QCString templateStr; static QCString templateStr;
static QCString baseName; static QCString baseName;
static QCString *specName; static QCString* specName;
static QCString formulaText; static QCString formulaText;
static QCString sectionRef;
static bool insideIDL = FALSE; static bool insideIDL = FALSE;
static bool insideCppQuote = FALSE; static bool insideCppQuote = FALSE;
static bool insideVerbatim = FALSE;
static int depthIf;
// state variable for reading the argument list of a function
static int argRoundCount; static int argRoundCount;
static int argSharpCount; static int argSharpCount;
static int currentArgumentContext; static int currentArgumentContext;
static int lastCopyArgStringContext; static int lastCopyArgStringContext;
static int lastCopyArgContext; static int lastCopyArgContext;
static int currentListIndentLevel;
static QCString *copyArgString; static QCString *copyArgString;
static QCString fullArgString; static QCString fullArgString;
static ArgumentList *currentArgumentList; static ArgumentList *currentArgumentList;
static QCString *currentTemplateSpec; static QCString *currentTemplateSpec;
static QCString curImageName;
static char lastCopyArgChar; static char lastCopyArgChar;
static QCString *pCopyRoundString; static QCString *pCopyRoundString;
static QCString *pCopyCurlyString; static QCString *pCopyCurlyString;
static QCString *pCopyQuotedString; static QCString *pCopyQuotedString;
static bool insideFormula;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static void initParser() static void initParser()
{ {
insideArgumentList=FALSE;
className.resize(0);
memberName.resize(0);
code.resize(0);
linkRef.resize(0);
linkText.resize(0);
codeBlock.resize(0);
htmlUrl.resize(0);
htmlText.resize(0);
currentIncludeFile.resize(0);
sectionLabel.resize(0); sectionLabel.resize(0);
sectionTitle.resize(0); sectionTitle.resize(0);
baseName.resize(0); baseName.resize(0);
...@@ -210,169 +162,7 @@ static void initParser() ...@@ -210,169 +162,7 @@ static void initParser()
gstat = FALSE; gstat = FALSE;
virt = Normal; virt = Normal;
baseVirt = Normal; baseVirt = Normal;
includeFileOffset = 0;
includeFileLength = 0;
firstLine = TRUE;
isTypedef = FALSE; isTypedef = FALSE;
inParamBlock = FALSE;
inRetValBlock = FALSE;
inExceptionBlock = FALSE;
inSeeBlock = FALSE;
inReturnBlock = FALSE;
inAuthorBlock = FALSE;
inDeprecatedBlock = FALSE;
inVersionBlock = FALSE;
inSinceBlock = FALSE;
inDateBlock = FALSE;
inBugBlock = FALSE;
inNoteBlock = FALSE;
inPreBlock = FALSE;
inPostBlock = FALSE;
inInvarBlock = FALSE;
inWarningBlock = FALSE;
inRemarkBlock = FALSE;
inAttentionBlock = FALSE;
inParBlock = FALSE;
firstSeeArg = FALSE;
}
//-----------------------------------------------------------------------------
void scanString(const char *s);
void internalParseDocument(const char *s);
//-----------------------------------------------------------------------------
class TableElem
{
public:
TableElem(int r,int c);
~TableElem();
int getRow() { return row; }
int getCol() { return col; }
OutputList *outputList() { return ol; }
private:
OutputList *ol;
int row;
int col;
};
TableElem::TableElem(int r,int c)
{
//printf("TableElem::TableElem(%d,%d)\n",r,c);
ol=new OutputList(outDoc);
outDoc=ol;
row=r;
col=c;
}
TableElem::~TableElem()
{
//printf("TableElem::~TableElem(%d,%d)\n",row,col);
delete ol; ol=0;
}
class Table
{
public:
Table();
~Table();
void newRow();
void newElem();
private:
OutputList *parentDoc;
QList<TableElem> *elemList;
int curRow;
int curCol;
int rows;
int cols;
};
Table::Table()
{
parentDoc=outDoc;
elemList=new QList<TableElem>;
elemList->setAutoDelete(TRUE);
curRow=curCol=rows=cols=0;
}
Table::~Table()
{
//printf("Table::~Table()\n");
// use elemList & cols & rows
if (cols>0 && rows>0)
{
parentDoc->startTable(cols);
TableElem *e=elemList->first();
while (e)
{
if (e->getRow()>0)
{
if (e->getCol()==0)
{
if (e->getRow()>1) parentDoc->endTableRow();
parentDoc->nextTableRow();
}
else
{
parentDoc->nextTableColumn();
}
*parentDoc+=*e->outputList();
parentDoc->endTableColumn();
}
e=elemList->next();
}
parentDoc->endTable();
}
delete elemList; elemList=0;
outDoc=parentDoc;
}
void Table::newRow()
{
//printf("Table::newRow()\n");
curRow++;
if (curRow>rows) rows=curRow;
curCol=0;
}
void Table::newElem()
{
//printf("Table::newElem(%d,%d)\n",curRow,curCol);
TableElem *te = new TableElem(curRow,curCol);
elemList->append(te);
curCol++;
if (curCol>cols) cols=curCol;
}
static QStack<Table> tableStack;
static Table *curTable;
static void startTable()
{
//printf("startTable()\n");
curTable=new Table;
tableStack.push(curTable);
}
static void endTable()
{
//printf("endTable()\n");
delete tableStack.pop(); // the destructor adds the table to the stream!
curTable=tableStack.top();
}
static void forceEndTable()
{
err("Error: More <table> tags found than </table> "
"tags in documentation block in file %s!\n",yyFileName);
while (!tableStack.isEmpty())
{
endTable();
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -383,15 +173,6 @@ static void lineCount() ...@@ -383,15 +173,6 @@ static void lineCount()
yyLineNr += (*c == '\n') ; yyLineNr += (*c == '\n') ;
} }
static void endArgumentList()
{
if (insideArgumentList)
{
insideArgumentList=FALSE;
outDoc->endItemList();
}
}
static void addType( Entry* current ) static void addType( Entry* current )
{ {
if( current->type.length() ) if( current->type.length() )
...@@ -405,69 +186,6 @@ static void addType( Entry* current ) ...@@ -405,69 +186,6 @@ static void addType( Entry* current )
current->argList->clear(); current->argList->clear();
} }
static void includeFile(OutputList &ol,const char *fileName,bool quiet)
{
//FileInfo *f;
bool ambig;
FileDef *fd;
if ((fd=findFileDef(exampleNameDict,fileName,ambig)))
{
currentIncludeFile=fileToString(fd->absFilePath());
includeFileOffset=0;
includeFileLength=currentIncludeFile.length();
OutputList codeFrag(&ol);
parseCode(codeFrag,0,currentIncludeFile,exampleDoc,exampleName);
if (!quiet)
{
ol.startCodeFragment();
ol+=codeFrag;
ol.endCodeFragment();
}
}
else if (ambig)
{
QCString text;
text.sprintf("Include file name %s is ambigious.\n",fileName);
text+="Possible candidates:\n";
text+=showFileDefMatches(exampleNameDict,fileName);
warn(yyFileName,yyLineNr,text);
}
else
{
warn(yyFileName,yyLineNr,
"Warning: example file %s is not found. "
"Check your EXAMPLE_PATH",fileName
);
}
}
static void verbIncludeFile(OutputList &ol,const char *name)
{
//FileInfo *f;
bool ambig;
FileDef *fd;
if ((fd=findFileDef(exampleNameDict,name,ambig)))
{
ol.startCodeFragment();
ol.codify(fileToString(fd->absFilePath()));
ol.endCodeFragment();
}
else if (ambig)
{
QCString text;
text.sprintf("Include file name %s is ambigious.\n",name);
text+=("Possible candidates:\n");
text+=showFileDefMatches(exampleNameDict,name);
warn(yyFileName,yyLineNr,text);
}
else
{
warn(yyFileName,yyLineNr,
"Warning: example file %s is not found. "
"Check your EXAMPLE_PATH",name);
}
}
static QCString stripQuotes(const char *s) static QCString stripQuotes(const char *s)
{ {
...@@ -481,100 +199,6 @@ static QCString stripQuotes(const char *s) ...@@ -481,100 +199,6 @@ static QCString stripQuotes(const char *s)
return name; return name;
} }
static QCString stripKnownExtensions(const char *text)
{
QCString result=text;
if (result.right(4)==".tex") result=result.left(result.length()-4);
else if (result.right(5)==".html") result=result.left(result.length()-5);
//printf("%s stripKnowExtensions(%s)\n",result.data(),text);
return result;
}
static void skipLine(OutputList &ol,const char *key)
{
bool found=FALSE;
while (!found)
{
QCString s;
char c;
while ( includeFileOffset<includeFileLength &&
(c=currentIncludeFile[includeFileOffset++])!='\n' && c!=0
) s+=c;
if (s.find(key)!=-1)
{
found=TRUE;
ol.writeString(" ");
parseCode(ol,className,s,exampleDoc,exampleName);
ol.writeString("\n");
}
else if (includeFileOffset==includeFileLength) found=TRUE;
}
}
static void skipUntil(const char *key)
{
bool found=FALSE;
while (!found)
{
QCString s;
int i=includeFileOffset;
char c;
while ( i<includeFileLength &&
(c=currentIncludeFile[i++])!='\n' && c!=0
) s+=c;
if (s.find(key)!=-1 || i==includeFileLength)
{
found=TRUE;
}
else
{
includeFileOffset=i;
}
}
}
static void showLine(OutputList &ol,const char *key)
{
QCString s;
char c;
bool found=FALSE;
while (!found)
{
while ( includeFileOffset<includeFileLength &&
(c=currentIncludeFile[includeFileOffset++])!='\n' && c!=0
) s+=c;
if (!s.stripWhiteSpace().isEmpty() ||
includeFileOffset==includeFileLength) found=TRUE;
}
if (s.find(key)!=-1)
{
ol.writeString(" ");
parseCode(ol,className,s,exampleDoc,exampleName);
ol.writeString("\n");
}
}
static void showUntil(OutputList &ol,const char *key)
{
bool found=FALSE;
while (!found)
{
QCString s;
char c;
while ( includeFileOffset<includeFileLength &&
(c=currentIncludeFile[includeFileOffset++])!='\n' && c!=0
) s+=c;
if (!s.stripWhiteSpace().isEmpty())
{
ol.writeString(" ");
parseCode(ol,className,s,exampleDoc,exampleName);
ol.writeString("\n");
if (s.find(key)!=-1) found=TRUE;
}
if (includeFileOffset==includeFileLength) found=TRUE;
}
}
static int newMemberGroupId() static int newMemberGroupId()
{ {
static int curGroupId=0; static int curGroupId=0;
...@@ -583,137 +207,8 @@ static int newMemberGroupId() ...@@ -583,137 +207,8 @@ static int newMemberGroupId()
static void newDocState(); static void newDocState();
//-----------------------------------------------------------------
struct IndentInfo
{
public:
IndentInfo(int i,bool e) : indent(i), enumerated(e) {};
~IndentInfo() {}
void startList()
{
if (enumerated) outDoc->startEnumList(); else outDoc->startItemList();
}
void endList()
{
if (enumerated) outDoc->endEnumList(); else outDoc->endItemList();
}
void writeItem()
{
outDoc->writeListItem();
}
int indent;
bool enumerated;
};
static QStack<IndentInfo> listIndentStack;
static bool insideItemList = FALSE;
static void addListItemMarker(const char *marker,int dashPos,bool enumerated)
{
// find the actual position at which the bullet was found
int i;
int indent=0;
for (i=0;i<dashPos;i++)
{
if (marker[i]=='\t')
{
indent+=Config::tabSize - (indent%Config::tabSize);
}
else
{
indent++;
}
}
//printf("list marker found at column %d enumerated %d\n",indent,enumerated);
if (!insideItemList)
{
listIndentStack.push(new IndentInfo(indent,enumerated));
listIndentStack.top()->startList();
listIndentStack.top()->writeItem();
insideItemList=TRUE;
}
else
{
IndentInfo *pPrevInfo = listIndentStack.top();
if (pPrevInfo->indent==indent && pPrevInfo->enumerated==enumerated)
// new item of same kind at the same indent level
{
pPrevInfo->writeItem();
}
else if (pPrevInfo->indent==indent)
// new item of diffent kind at the same indent level
{
// switch to a diffent list type
pPrevInfo->endList();
pPrevInfo->enumerated=enumerated;
pPrevInfo->startList();
pPrevInfo->writeItem();
}
else if (pPrevInfo->indent<indent) // start sub item list
{
listIndentStack.push(new IndentInfo(indent,enumerated));
listIndentStack.top()->startList();
listIndentStack.top()->writeItem();
}
else // end sub item list
{
pPrevInfo->endList();
listIndentStack.pop();
delete pPrevInfo;
// safe guard against wrong indenting
if (listIndentStack.isEmpty())
{
insideItemList=FALSE;
warn(yyFileName,yyLineNr,
"Warning: list item with invalid indent found!");
}
else
{
listIndentStack.top()->writeItem();
}
}
}
}
// end the current (nested) list regardless of the nesting level.
static void forceEndItemList()
{
IndentInfo *info;
while ((info=listIndentStack.pop())!=0)
{
info->endList();
delete info;
}
insideItemList=FALSE;
}
//----------------------------------------------------------------- //-----------------------------------------------------------------
static bool inBlock()
{
return inParamBlock || inRetValBlock || inSeeBlock || inReturnBlock || inAuthorBlock ||
inVersionBlock || inSinceBlock || inDateBlock || inWarningBlock || inRemarkBlock ||
inAttentionBlock || inBugBlock || inNoteBlock ||
inParBlock || inExceptionBlock || inDeprecatedBlock || inPreBlock ||
inPostBlock || inInvarBlock;
}
static void endBlock()
{
if (inParamBlock || inRetValBlock || inExceptionBlock)
{
outDoc->endDescTableData();
outDoc->endDescTable();
}
outDoc->endDescList();
inParamBlock=inRetValBlock=inSeeBlock=inReturnBlock=inAuthorBlock=
inVersionBlock=inSinceBlock=inDateBlock=inBugBlock=inNoteBlock=inWarningBlock=
inParBlock=inExceptionBlock=inDeprecatedBlock=inPreBlock=inPostBlock=
inInvarBlock=inRemarkBlock=inAttentionBlock=FALSE;
}
static void addSection() static void addSection()
{ {
//printf("New section pageName=%s label=%s title=%s\n", //printf("New section pageName=%s label=%s title=%s\n",
...@@ -761,1584 +256,223 @@ static bool nameIsOperator(QCString &name) ...@@ -761,1584 +256,223 @@ static bool nameIsOperator(QCString &name)
(name.length()==8 || !isId(name.at(name.length()-9))); (name.length()==8 || !isId(name.at(name.length()-9)));
} }
static void checkFormula()
{
if (insideFormula)
{
warn(yyFileName,yyLineNr,"Warning: End of comment block while inside formula.");
}
}
static void checkDocs() static void checkDocs()
{ {
checkFormula();
if ((current->brief.length()>2 && if ((current->brief.length()>2 &&
current->brief.at(0)=='<' && current->brief.at(1)==' ') || current->brief.at(0)=='<' && current->brief.at(1)==' ') ||
(current->doc.length()>2 && (current->doc.length()>2 &&
current->doc.at(0)=='<' && current->doc.at(1)==' ') current->doc.at(0)=='<' && current->doc.at(1)==' ')
) )
{ {
warn("Warning: Found lonely '<' symbol at the start of the documentation " warn(yyFileName,yyLineNr,"Warning: Found lonely '<' symbol at the start of the documentation.");
"at line %d of %s",yyLineNr,yyFileName);
} }
} }
//static bool curLatexState; static QCString extractName(const QCString &s)
//static bool curManState;
//static bool curHtmlState;
//
//static void storeOutputListState()
//{
// curLatexState = outDoc->isEnabled(OutputGenerator::Latex);
// curHtmlState = outDoc->isEnabled(OutputGenerator::Html);
// curManState = outDoc->isEnabled(OutputGenerator::Man);
//}
//
//static void restoreOutputListState()
//{
// if (curLatexState)
// outDoc->enable(OutputGenerator::Latex);
// else
// outDoc->disable(OutputGenerator::Latex);
// if (curHtmlState)
// outDoc->enable(OutputGenerator::Html);
// else
// outDoc->disable(OutputGenerator::Html);
// if (curManState)
// outDoc->enable(OutputGenerator::Man);
// else
// outDoc->disable(OutputGenerator::Man);
//}
enum ImageTypes
{
IT_Html,
IT_Latex
};
// search for an image in the imageNameDict and if found
// copies the image to the output directory (which is the
// html directory if type==0 or the latex directory if type==1)
static QCString findAndCopyImage(const char *fileName,ImageTypes type)
{
QCString result;
bool ambig;
FileDef *fd;
if ((fd=findFileDef(imageNameDict,fileName,ambig)))
{
QFile inImage(QString(fd->absFilePath().data()));
if (inImage.open(IO_ReadOnly))
{
result = fileName;
int i;
if ((i=result.findRev('/'))!=-1 || (i=result.findRev('\\'))!=-1)
{
result.right(result.length()-i-1);
}
QCString outputDir;
switch(type)
{
case IT_Html:
outputDir = Config::htmlOutputDir;
break;
case IT_Latex:
outputDir = Config::latexOutputDir;
break;
}
QCString outputFile = outputDir+"/"+result;
QFile outImage(QString(outputFile.data()));
if (outImage.open(IO_WriteOnly)) // copy the image
{
char *buffer = new char[inImage.size()];
inImage.readBlock(buffer,inImage.size());
outImage.writeBlock(buffer,inImage.size());
outImage.flush();
delete buffer;
}
else
{
warn(yyFileName,yyLineNr,
"Warning: could not write output image %s",outputFile.data());
}
}
else
{
warn(yyFileName,yyLineNr,
"Warning: could not open image %s",fileName);
}
}
else if (ambig)
{
QCString text;
text.sprintf("Warning: image file name %s is ambigious.\n",fileName);
text+="Possible candidates:\n";
text+=showFileDefMatches(imageNameDict,fileName);
warn(yyFileName,yyLineNr,text);
}
else
{
result=fileName;
if (result.left(5)!="http:" && result.left(6)!="https:")
{
warn(yyFileName,yyLineNr,
"Warning: image file %s is not found in IMAGE_PATH: "
"assuming external image.",fileName
);
}
}
return result;
}
// find first identifier in string (exclusing type keywords)
QCString extractName(const QCString &s)
{ {
static const QRegExp id("[a-z_A-Z][a-z_A-Z0-9]*"); static const QRegExp id("[a-z_A-Z][a-z_A-Z0-9]*");
int i,p=0,l; int i,p=0,l;
while ((i=id.match(s,p,&l))!=-1) while ((i=id.match(s,p,&l))!=-1)
{ {
QCString idstr=s.mid(i,l); QCString idstr=s.mid(i,l);
if (idstr!="struct" && idstr!="class" && idstr!="union") return idstr; if (idstr!="struct" && idstr!="class" && idstr!="union") return idstr;
p=i+l; p=i+l;
} }
return ""; return "";
} }
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
#undef YY_INPUT
//static void addToBody(const char *text); #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size);
//static void addToBodyCond(const char *text);
/* ----------------------------------------------------------------- */ static int yyread(char *buf,int max_size)
#undef YY_INPUT {
#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); int c=0;
while( c < max_size && inputString[inputPosition] )
static int yyread(char *buf,int max_size) {
{ *buf = inputString[inputPosition++] ;
int c=0; //printf("%d (%c)\n",*buf,*buf);
while( c < max_size && inputString[inputPosition] ) c++; buf++;
{ }
*buf = inputString[inputPosition++] ; return c;
//printf("%d (%c)\n",*buf,*buf); }
c++; buf++;
} %}
return c;
} CMD ("\\"|"@")
SECTIONCMD {CMD}("image"|"author"|"internal"|"version"|"date"|"deprecated"|"param"|"exception"|"return"[s]?|"retval"|"bug"|"warning"|"par"|"sa"|"see"|"pre"|"post"|"invariant"|"note"|"remark"[s]?|"todo"|"test"|"ingroup")
//ATTR ((({BN}+[^\>]+)/">")?) BN [ \t\n\r]
%} BL [ \t\r]*"\n"
B [ \t]
CMD ("\\"|"@") BS ^(({B}*"//")?)(({B}*"*"+)?){B}*
SECTIONCMD {CMD}("image"|"author"|"internal"|"version"|"date"|"deprecated"|"param"|"exception"|"return"[s]?|"retval"|"bug"|"warning"|"par"|"sa"|"see"|"pre"|"post"|"invariant"|"note"|"remark"[s]?|"todo"|"test"|"ingroup") FILESCHAR [a-z_A-Z0-9\\:\\\/\-\+]
BN [ \t\n\r] FILEECHAR [a-z_A-Z0-9\-\+]
BL [ \t\r]*"\n" FILE ({FILESCHAR}*{FILEECHAR}+("."{FILESCHAR}*{FILEECHAR}+)*)|("\""[^\n\"]+"\"")
B [ \t] ID [a-z_A-Z][a-z_A-Z0-9]*
BS ^(({B}*"//")?)(({B}*"*"+)?){B}* SCOPEID {ID}({ID}*{BN}*"::"{BN}*)*({ID}?)
FILE ([a-z_A-Z0-9\\:\/\-\+]+("."[a-z_A-Z0-9\\:\/\-\+]+)*)|("\""[^\n\"]+"\"") SCOPENAME (({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID})
FILEMASK [a-z_A-Z0-9\.\\:\/\-\+]+"."[a-z_A-Z0-9\.\-\+]*[a-z_A-Z0-9\-\+] ATTR ({B}+[^>\n]*)?
ID [a-z_A-Z][a-z_A-Z0-9]* A [aA]
SCOPEID {ID}({ID}*{BN}*"::"{BN}*)*({ID}?) BR [bB][rR]
SCOPENAME (({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID}) PRE [pP][rR][eE]
SCOPEMASK {ID}?(("::"|"#")?(~)?{ID})+ TABLE [tT][aA][bB][lL][eE]
URLMASK [a-z_A-Z0-9\~\:\?\@\#\.\-\+\/\=]+ TITLE [tT][iI][tT][lL][eE]
NONTERM [\{\}\[\]\`\~\@\|\-\+\#\$\/\\\!\%\^\&\*()a-z_A-Z<>0-9]
WORD ({NONTERM}+([^\n\t ]*{NONTERM}+)?)|("\""[^\n\"]"\"") %option noyywrap
ATTR ({B}+[^>\n]*)?
A [aA] %x Define
BOLD [bB] %x DefineArg
BODY [bB][oO][dD][yY] %x DefineEnd
BR [bB][rR] %x CompoundName
EM [eE][mM] %x ClassVar
CENTER [cC][eE][nN][tT][eE][rR] %x ClassTemplSpec
CODE [cC][oO][dD][eE] %x Bases
DL [dD][lL] %x BasesProt
DD [dD][dD] %x NextSemi
DT [dD][tT] %x FindMembers
DFN [dD][fF][nN] %x FindMemberName
FORM [fF][oO][rR][mM] %x FindFields
H1 [hH]1 %x FindFieldArg
H2 [hH]2 %x Function
H3 [hH][3-6] %x FuncRound
HEAD [hH][eE][aA][dD] %x ExcpRound
HR [hH][rR] %x FuncQual
HREF [hH][rR][eE][fF] %x Operator
I [iI] %x Array
IMG [iI][mM][gG] %x ReadBody
INPUT [iI][nN][pP][uU][tT] %x Using
LI [lL][iI] %x UsingDirective
META [mM][eE][tT][aA] %x NameSpaceDocArg1
MULTICOL [mM][uU][lL][tT][iI][cC][oO][lL] %x SkipCurly
NAME [nN][aA][mM][eE] %x SkipCurlyCpp
OL [oO][lL] %x SkipCurlyEndDoc
P [pP] %x SkipString
PRE [pP][rR][eE] %x SkipInits
SMALL [sS][mM][aA][lL][lL] %x SkipCPP
STRONG [sS][tT][rR][oO][nN][gG] %x SkipCPPBlock
SUB [sS][uU][bB] %x SkipComment
SUP [sS][uU][pP] %x SkipCxxComment
SRC [sS][rR][cC] %x SkipCurlyBlock
TABLE [tT][aA][bB][lL][eE] %x SkipRoundBlock
TITLE [tT][iI][tT][lL][eE] %x SkipCode
TD [tT][dD] %x Sharp
TR [tT][rR] %x SkipSharp
TT [tT][tT] %x SkipRound
UL [uU][lL] %x SkipSquare
VAR [vV][aA][rR] %x TypedefName
DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") %x Comment
%x Doc
%option noyywrap %x JavaDoc
%x ClassDoc
%x Define %x LineDoc
%x DefineArg %x DefLineDoc
%x DefineEnd %x ClassDocArg1
%x Include %x ClassDocArg2
%x CompoundName %x ClassDocArg3
%x ClassVar %x ClassDocFunc
%x ClassTemplSpec %x ClassDocFuncPtr
%x Bases %x ClassDocFuncQual
%x BasesProt %x ClassDocFuncSkipLine
%x NextSemi %x ClassDocFuncExc
%x FindMembers %x ClassDocDefine
%x FindMemberName %x ClassDocRelates
%x FindFields %x ClassDocBrief
%x FindFieldArg %x ClassDocOverload
%x Function %x ClassDefineArgs
%x FuncRound %x DocBaseClass
%x ExcpRound %x CppQuote
%x FuncQual %x EndCppQuote
%x Operator %x GroupDocArg1
%x Array %x GroupDocArg2
%x ReadBody %x GroupName
%x Using %x GroupHeader
%x UsingDirective %x StoreGroupDocs
%x NameSpaceDocArg1 %x AfterDoc
%x SkipCurly %x AfterDocBrief
%x SkipCurlyCpp %x AfterDocLine
%x SkipCurlyEndDoc %x PageDoc
%x SkipString %x PageDocTitle
%x SkipInits %x PageDocArg1
%x SkipCPP %x PageDocArg2
%x SkipCPPBlock %x FileDocArg1
%x SkipComment %x FileDocArg2
%x SkipCxxComment %x ExampleDoc
%x SkipCurlyBlock %x ExampleDocArg1
%x SkipRoundBlock %x EnumDoc
%x SkipCode %x EnumDocArg1
%x Sharp %x FuncPtr
%x SkipSharp %x EndFuncPtr
%x SkipRound %x FuncFunc
%x SkipSquare %x FuncFuncEnd
%x TypedefName %x FuncFuncType
%x Comment %x MemberSpec
%x Doc %x MemberSpecSkip
%x JavaDoc %x SkipVerbatim
%x ClassDoc %x TodoParam
%x LineDoc %x TestParam
%x DefLineDoc %x SectionLabel
%x ClassDocArg1 %x SectionTitle
%x ClassDocArg2 %x SkipTemplate
%x ClassDocArg3 %x EndTemplate
%x ClassDocFunc %x CopyArgString
%x ClassDocFuncPtr %x CopyArgRound
%x ClassDocFuncQual %x CopyArgSharp
%x ClassDocFuncSkipLine %x CopyArgComment
%x ClassDocFuncExc %x CopyArgCommentLine
%x ClassDocDefine %x SkipUnionSwitch
%x ClassDocRelates %x ReadFuncArgType
%x ClassDocBrief %x ReadTempArgs
%x ClassDocOverload %x Specialization
%x ClassDefineArgs %x SkipHtmlComment
%x CppQuote %x ReadFormulaShort
%x EndCppQuote %x ReadFormulaLong
%x GroupDocArg1 %x AnchorLabel
%x GroupDocArg2 %x ReadInitializer
%x GroupName %x CopyString
%x GroupHeader %x CopyRound
%x StoreGroupDocs %x CopyCurly
%x AfterDoc %x IDLUnionCase
%x AfterDocBrief
%x AfterDocLine %%
%x PageDoc
%x PageDocTitle <*>\x06[^\x06]*\x06 { // new file
%x PageDocArg1 if (memberGroupId!=NOGROUP)
%x PageDocArg2
%x FileDocArg1
%x FileDocArg2
%x ExampleDoc
%x ExampleDocArg1
%x EnumDoc
%x EnumDocArg1
%x FuncPtr
%x EndFuncPtr
%x FuncFunc
%x FuncFuncEnd
%x FuncFuncType
%x MemberSpec
%x MemberSpecSkip
%x SkipVerbatim
%x Text
%x DocScan
%x DocParam
%x DocException
%x DocHtmlScan
%x DocLatexScan
%x DocEmphasis
%x DocBold
%x DocCode
%x DocIf
%x DocCodeBlock
%x DocInternal
%x DocLink
%x DocLinkText
%x DocSkipWord
%x DocInclude
%x DocDontInclude
%x DocDescItem
%x DocHtmlLink
%x DocHtmlAnchor
%x DocHtmlHref1
%x DocHtmlHref2
%x DocBaseClass
%x DocSkiplineKey
%x DocSkipKey
%x DocLineKey
%x DocUntilKey
%x DocKeyEnd
%x DocPar
%x DocRefName
%x DocVerbatim
%x DocVerbInc
%x DocIndexWord
%x DocRef
%x DocRefArg
%x DocRefArgStart
%x DocRefItem
%x DocRefItemName
%x DocImage
%x DocHtmlImageName
%x DocLatexImageName
%x DocLatexImageWidth
%x TodoParam
%x TestParam
%x SectionLabel
%x SectionTitle
%x SkipTemplate
%x EndTemplate
%x CopyArgString
%x CopyArgRound
%x CopyArgSharp
%x CopyArgComment
%x CopyArgCommentLine
%x SkipUnionSwitch
%x ReadFuncArgType
%x ReadTempArgs
%x Specialization
%x SkipHtmlComment
%x ReadFormulaShort
%x ReadFormulaLong
%x AnchorLabel
%x ReadInitializer
%x CopyString
%x CopyRound
%x CopyCurly
%x IDLUnionCase
%%
<*>\x06[^\x06]*\x06 { // new file
if (memberGroupId!=NOGROUP)
{
warn(yyFileName,yyLineNr,"Warning: Missing //@}");
memberGroupId=NOGROUP;
}
yyLineNr= 0 ; // there is always an extra newline at the start of the file
int i;
for( i = 0 ; yytext[i+1] != 6 ; i++ )
yyFileName[i] = yytext[i+1] ;
yyFileName[i] = 0 ;
insideIDL = i>4 && strcmp(&yyFileName[i-4],".idl")==0;
msg("Parsing file %s...\n",yyFileName);
current_root = global_root ;
initParser();
current->reset();
int sec=guessSection(yyFileName);
if (sec)
{
current->name = yyFileName;
current->name = current->name;
current->section = sec;
current_root->addSubEntry(current);
current = new Entry;
}
BEGIN( FindMembers );
}
<*>\x0d
<DocScan>^{B}*(("//"{B}*)?)"*"*{B}*"-"("#")?{B}+ { /* found list item marker */
QCString text=yytext;
int dashPos = text.findRev('-');
//printf("dashPos=%d char='%c'\n",dashPos,text.at(dashPos+1));
bool isEnumerated = text.at(dashPos+1)=='#';
addListItemMarker(yytext,dashPos,isEnumerated);
}
<DocScan>\n{B}*(("//"{B}*)?)"*"*{B}*"-"("#")?{B}+ { /* found list item marker */
QCString text=yytext;
int dashPos = text.findRev('-');
//printf("dashPos=%d char='%c'\n",dashPos,text.at(dashPos+1));
bool isEnumerated = text.at(dashPos+1)=='#';
addListItemMarker(yytext+1,dashPos,isEnumerated);
}
<DocScan,Text>"&copy;" { outDoc->writeCopyright(); }
<DocScan,Text>"&quot;" { outDoc->writeQuote(); }
<DocScan,Text>"&"[AEIOUYaeiouy]"uml;" { outDoc->writeUmlaut(yytext[1]); }
<DocScan,Text>"&"[AEIOUYaeiouy]"acute;" { outDoc->writeAcute(yytext[1]); }
<DocScan,Text>"&"[AEIOUaeiou]"grave;" { outDoc->writeGrave(yytext[1]); }
<DocScan,Text>"&"[AEIOUaeiou]"circ;" { outDoc->writeCirc(yytext[1]); }
<DocScan,Text>"&"[ANOano]"tilde;" { outDoc->writeTilde(yytext[1]); }
<DocScan,Text>"&szlig;" { outDoc->writeSharpS(); }
<DocScan,Text>"&[aA]ring;" { outDoc->writeRing(yytext[1]); }
<DocScan,DocHtmlScan,DocLatexScan>"$("[a-z_A-Z]+")" {
QCString envvar=&yytext[2];
envvar=envvar.left(envvar.length()-1);
outDoc->docify(getenv(envvar));
}
<DocScan>{CMD}"htmlonly"/[^a-z_A-Z0-9] {
outDoc->pushGeneratorState(); /*storeOutputListState();*/
outDoc->disableAllBut(OutputGenerator::Html);
BEGIN(DocHtmlScan);
}
<DocHtmlScan>{CMD}"endhtmlonly"/[^a-z_A-Z0-9] {
/*restoreOutputListState();*/
outDoc->popGeneratorState();
BEGIN(DocScan);
}
<DocScan>{CMD}"latexonly"/[^a-z_A-Z0-9] {
/*storeOutputListState();*/
outDoc->pushGeneratorState();
outDoc->disableAllBut(OutputGenerator::Latex);
BEGIN(DocLatexScan);
}
<DocLatexScan>{CMD}"endlatexonly"/[^a-z_A-Z0-9] {
/*restoreOutputListState();*/
outDoc->popGeneratorState();
BEGIN(DocScan);
}
<DocHtmlScan,DocLatexScan>"//"|"/*"|"*/" {
outDoc->writeString(yytext);
}
<DocHtmlScan,DocLatexScan>.|\n {
char c[2];
c[0]=*yytext;c[1]='\0';
outDoc->writeString(c);
}
<DocScan>"\\postheader"/{BN}
<DocScan>"\\functionindex"/{BN} { writeMemberList(*outDoc); }
<DocScan>"\\classhierarchy"/{BN} { writeClassHierarchy(*outDoc); }
<DocScan>"\\annotatedclasslist"/{BN} { writeAnnotatedClassList(*outDoc); }
<DocScan>"\\headerfilelist"/{BN} { /*TODO: fix this writeHeaderFileList(*outDoc); */ }
<DocScan>"\\header"/{BN} { BEGIN( DocSkipWord ); }
<DocScan>"\\define"/{BN} { BEGIN( DocSkipWord ); }
<DocScan>{CMD}"verbinclude"/{BN} { BEGIN( DocVerbInc ); }
<DocVerbInc>{FILE} {
verbIncludeFile(*outDoc,stripQuotes(yytext));
BEGIN( DocScan );
}
<DocScan>{CMD}"verbatim"/[^a-z_A-Z0-9] {
outDoc->startCodeFragment();
insideVerbatim=TRUE;
BEGIN(DocVerbatim);
}
<DocVerbatim>{CMD}"endverbatim"/[^a-z_A-Z0-9] {
outDoc->endCodeFragment();
insideVerbatim=FALSE;
BEGIN(DocScan);
}
<DocVerbatim>[^\n\\\@]*"\n" {
//printf("docifying: %s\n",yytext);
outDoc->codify(yytext);
}
<DocVerbatim>"\n"|"//"|"/*"|"*/" {
outDoc->codify(yytext);
}
<DocVerbatim>. {
//printf("char %c\n",*yytext);
char c[2];c[0]=*yytext;c[1]='\0';
outDoc->codify(c);
}
<DocScan>{CMD}"internal"/{BN} {
if (!Config::internalDocsFlag)
{
outDoc->newParagraph();
scanString(theTranslator->trForInternalUseOnly()+"\n");
//outDoc->writeString("For internal use only.\n");
BEGIN( DocInternal );
}
}
<DocScan>"\\reimp"/{BN} {
outDoc->newParagraph();
scanString(theTranslator->trReimplementedForInternalReasons()+"\n");
}
<DocScan>{CMD}"link"/{BN} { BEGIN( DocLink ); }
<DocSkipWord>[a-z_A-Z0-9.:()]+ { BEGIN( DocScan ); }
<DocLink>[a-z_A-Z0-9:#.,~&*/<>()\-\+]+ { // TODO: support operators as well!
linkRef = stripKnownExtensions(yytext);
linkText = "";
BEGIN( DocLinkText );
}
<DocLinkText>. { linkText += *yytext; }
<DocLinkText>"\n" { linkText += " "; }
<DocLink,DocLinkText>{CMD}"endlink" { // <- needed for things like \endlink.
//printf("GenerateLink className=`%s' linkRef=`%s' linkText=`%s'\n",
// className.data(),linkRef.data(),linkText.data());
generateLink(*outDoc,className,linkRef,inSeeBlock,linkText.stripWhiteSpace());
BEGIN( DocScan );
}
/*
<DocScan>"@ref"{B}+ {
BEGIN(DocRef);
}
<DocRef>{SCOPENAME} {
generateLink(*outDoc,className,yytext,TRUE,0);
BEGIN( DocScan );
}
*/
<DocScan>{CMD}"endlink"/[^a-z_A-Z0-9] { warn(yyFileName,yyLineNr,
"Warning: \\endlink without \\link "
"in documentation."
);
}
<DocScan>{CMD}"addindex"{B}+ {
BEGIN(DocIndexWord);
}
<DocScan>"\\form#"[0-9]+ {
Formula *formula=formulaNameDict[yytext];
if (formula)
{
QCString formName;
formName.sprintf("form-%d.gif",formula->getId());
outDoc->writeFormula(formName,formula->getFormulaText());
}
}
<DocIndexWord>[^\n]+ {
//printf("Adding %s to index\n",yytext);
outDoc->addToIndex(yytext,0);
BEGIN(DocScan);
}
<DocScan>{CMD}("arg"|"li")/{BN} {
if (insideArgumentList)
{
outDoc->writeListItem();
}
else
{
outDoc->startItemList();
outDoc->writeListItem();
insideArgumentList=TRUE;
}
}
<DocScan>(({B}*"\n"){2,}{B}*)?{CMD}"par"{B}* {
BEGIN(DocPar);
}
<DocPar>[^\n]*{BN} {
QCString title=QCString(yytext).stripWhiteSpace();
bool b = inBlock();
if (!title.isEmpty())
{
endArgumentList();
if (b) endBlock();
inParBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
outDoc->docify(title);
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->newParagraph();
}
BEGIN(DocScan);
}
<DocScan>{CMD}"warning"/{BN} {
endArgumentList();
if (!inWarningBlock)
{
if (inBlock()) endBlock();
inWarningBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trWarning()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"remark"[s]?/{BN} {
endArgumentList();
if (!inRemarkBlock)
{
if (inBlock()) endBlock();
inRemarkBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trRemarks()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"attention"[s]?/{BN} {
endArgumentList();
if (!inAttentionBlock)
{
if (inBlock()) endBlock();
inAttentionBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trAttention()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"bug"[s]?/{BN} {
endArgumentList();
if (!inBugBlock)
{
if (inBlock()) endBlock();
inBugBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trBugsAndLimitations()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"note"[s]?/{BN} {
endArgumentList();
if (!inNoteBlock)
{
if (inBlock()) endBlock();
inNoteBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trNote()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"pre"/{BN} {
endArgumentList();
if (!inPreBlock)
{
if (inBlock()) endBlock();
inPreBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trPrecondition()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"post"/{BN} {
endArgumentList();
if (!inPostBlock)
{
if (inBlock()) endBlock();
inPostBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trPostcondition()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"invariant"/{BN} {
endArgumentList();
if (!inInvarBlock)
{
if (inBlock()) endBlock();
inInvarBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trInvariant()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"version"/{BN} {
endArgumentList();
if (!inVersionBlock)
{
if (inBlock()) endBlock();
inVersionBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trVersion()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"since"/{BN} {
endArgumentList();
if (!inSinceBlock)
{
if (inBlock()) endBlock();
inSinceBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trSince()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>{CMD}"date"/{BN} {
endArgumentList();
if (!inDateBlock)
{
if (inBlock()) endBlock();
inDateBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trDate()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>"\\todo "[0-9]+ { // this tag is generated in an earlier pass
if (Config::generateTodoList)
{
QCString numStr=yytext;
numStr=numStr.right(numStr.length()-6);
bool ok; int num = numStr.toUInt(&ok);
RefItem *item = todoList.getRefItem(num);
ASSERT(item!=0);
endArgumentList();
if (inBlock()) endBlock();
outDoc->startDescList();
outDoc->startBold();
outDoc->writeObjectLink(0,"todo",item->listAnchor,theTranslator->trTodo()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
internalParseDocument(item->text);
outDoc->endDescList();
}
}
<DocScan>"\\test "[0-9]+ { // this tag is generated in an earlier pass
if (Config::generateTestList)
{
QCString numStr=yytext;
numStr=numStr.right(numStr.length()-6);
bool ok; int num = numStr.toUInt(&ok);
RefItem *item = testList.getRefItem(num);
ASSERT(item!=0);
endArgumentList();
if (inBlock()) endBlock();
outDoc->startDescList();
outDoc->startBold();
outDoc->writeObjectLink(0,"test",item->listAnchor,theTranslator->trTest()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
internalParseDocument(item->text);
outDoc->endDescList();
}
}
<DocScan>{CMD}"deprecated"/{BN} {
endArgumentList();
if (!inDeprecatedBlock)
{
if (inBlock()) endBlock();
inDeprecatedBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trDeprecated()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->writeDescItem();
}
}
<DocScan>"$"[a-zA-Z_0-9]+":"[^\n\$]+"$" { // RCS tag
QCString tagName(&yytext[1]);
int i=tagName.find(':');
tagName=tagName.left(i);
QCString tagText=&yytext[i+2];
tagText=tagText.left(tagText.length()-1);
endArgumentList();
if (inBlock()) endBlock();
outDoc->startDescList();
outDoc->startBold();
scanString(tagName+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
scanString(tagText);
outDoc->endDescList();
}
<DocScan>{CMD}"author"/{BN} {
endArgumentList();
if (!inAuthorBlock)
{
if (inBlock()) endBlock();
inAuthorBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trAuthors()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->docify(", ");
}
}
<DocScan>{CMD}("return"([s])?|"result")/{BN} {
endArgumentList();
if (!inReturnBlock)
{
if (inBlock()) endBlock();
inReturnBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trReturns()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
}
<DocScan>{CMD}("sa"|"see")/{BN} {
endArgumentList();
if (!inSeeBlock)
{
if (inBlock()) endBlock();
inSeeBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trSeeAlso()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
}
else
{
outDoc->docify(", ");
}
}
<DocScan>(({B}*"\n"){2,}{B}*)?{CMD}"param"/{BN} {
QCString t=yytext;
if (t.contains('\n')>1 && insideItemList)
{
forceEndItemList();
}
endArgumentList();
if (!inParamBlock)
{
if (inBlock()) endBlock();
inParamBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trParameters()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
outDoc->startDescTable();
}
else
{
outDoc->endDescTableData();
}
BEGIN(DocParam);
}
<DocScan>(({B}*"\n"){2,}{B}*)?{CMD}"retval"/{BN} {
QCString t=yytext;
if (t.contains('\n')>1 && insideItemList)
{
forceEndItemList();
}
endArgumentList();
if (!inRetValBlock)
{
if (inBlock()) endBlock();
inRetValBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trReturnValues()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
outDoc->startDescTable();
}
else
{
outDoc->endDescTableData();
}
BEGIN(DocParam);
}
<DocScan>(({B}*"\n"){2,}{B}*)?{CMD}("exception"|"throw")s?/{BN} {
QCString t=yytext;
if (t.contains('\n')>1 && insideItemList)
{
forceEndItemList();
}
endArgumentList();
if (!inExceptionBlock)
{
if (inBlock()) endBlock();
inExceptionBlock=TRUE;
outDoc->startDescList();
outDoc->startBold();
scanString(theTranslator->trExceptions()+": ");
outDoc->endBold();
outDoc->endDescTitle();
outDoc->writeDescItem();
outDoc->startDescTable();
}
else
{
outDoc->endDescTableData();
}
BEGIN(DocException);
}
<DocScan>"\\capt".*
<DocParam>({DOCPARAM}{BN}*","{BN}*)*{DOCPARAM} {
outDoc->startDescTableTitle();
outDoc->startEmphasis();
outDoc->docify(substitute(yytext,"\"",""));
outDoc->endEmphasis();
outDoc->endDescTableTitle();
outDoc->startDescTableData();
BEGIN(DocScan);
}
<DocException>{SCOPENAME} {
outDoc->startDescTableTitle();
outDoc->startEmphasis();
outDoc->docify(yytext);
outDoc->endEmphasis();
outDoc->endDescTableTitle();
outDoc->startDescTableData();
BEGIN(DocScan);
}
<DocScan>{CMD}"section "{ID}"\n" {
QCString secName=&yytext[9]; // skip "\section "
secName=secName.left(secName.length()-1); // remove \n
//printf("SectionName %s found\n",secName.data());
SectionInfo *sec;
if ((sec=sectionDict[secName]))
{
//printf("Title %s\n",sec->title.data());
outDoc->writeSection(sec->label,sec->title,
sec->type==SectionInfo::Subsection);
}
}
<DocScan>{CMD}"anchor "{ID}"\n" {
QCString secName=&yytext[8];
secName=secName.left(secName.length()-1);
SectionInfo *sec;
if ((sec=sectionDict[secName]))
{
//printf("writeAnchor %s_%s\n",sec->fileName.data(),sec->label.data());
outDoc->writeAnchor(sec->fileName,sec->label);
}
}
<DocScan>{CMD}"ref" {
BEGIN(DocRefName);
}
<DocScan>{CMD}"refitem" {
BEGIN(DocRefItem);
}
<DocScan>{CMD}"if"/{BN} {
outDoc->pushGeneratorState();
depthIf++;
BEGIN(DocIf);
}
<DocScan>{CMD}"endif"/[^a-z_A-Z0-9] {
if (--depthIf<0)
{
warn(yyFileName,yyLineNr,
"Warning: documentation block contains \\endif without "
"matching \\if found in documentation."
);
}
else
{
outDoc->popGeneratorState();
}
}
<DocIf>[^\n\t ]+ {
if (Config::sectionFilterList.find(yytext)==-1)
{
outDoc->disableAll();
}
BEGIN(DocScan);
}
<DocRefName>{SCOPENAME}|{FILE} {
QCString ref=yytext;
SectionInfo *sec;
if ((sec=sectionDict[ref]))
{
QCString text;
if (sec->title.isEmpty())
text=sec->label;
else
text=sec->title;
if (sec->type==SectionInfo::Anchor)
{
//outDoc->writeSectionRefAnchor(sec->fileName,sec->label,text);
outDoc->writeObjectLink(0,sec->fileName,sec->label,text);
writePageRef(*outDoc,sec->label,0);
}
else
{
//printf(" ref sec=%p sec->fileName=%s text=%s\n",sec,sec->fileName.data(),text.data());
outDoc->writeSectionRef(sec->fileName,sec->label,text);
}
}
else if (!generateLink(*outDoc,className,yytext,TRUE,0))
{
warn(yyFileName,yyLineNr,"Warning: reference to unknown section %s!",yytext);
//outDoc->writeBoldString(" unknown reference! ");
}
BEGIN(DocScan);
}
<DocRefName>({SCOPENAME}|{FILE}){B}+/"\"" {
sectionRef=yytext;
sectionRef=sectionRef.stripWhiteSpace();
BEGIN(DocRefArgStart);
}
<DocRefArgStart>"\"" {
BEGIN(DocRefArg);
}
<DocRefArg>[^\"\n]+[\n\"] {
yytext[yyleng-1]='\0';
QCString text=substitute(yytext,"\\\\","\\");
SectionInfo *sec;
if ((sec=sectionDict[sectionRef]))
{
if (sec->type==SectionInfo::Anchor)
{
//outDoc->writeSectionRefAnchor(sec->fileName,sec->label,text);
outDoc->writeObjectLink(0,sec->fileName,sec->label,text);
//printf("Writing page ref `%s'\n",sec->label.data());
writePageRef(*outDoc,sec->label,0);
}
else
{
outDoc->writeSectionRef(sec->fileName,sec->label,text);
}
}
else if (!generateLink(*outDoc,className,sectionRef,TRUE,text))
{
warn(yyFileName,yyLineNr,"Warning: reference to unknown section %s!",sectionRef.data());
outDoc->writeBoldString(" unknown reference! ");
}
BEGIN(DocScan);
}
<DocRefItem>{ID} {
sectionRef=yytext;
BEGIN(DocRefItemName);
}
<DocRefItemName>.*/"\n" {
SectionInfo *sec;
QCString text=yytext;
if ((sec=sectionDict[sectionRef]))
{
outDoc->writeSectionRefItem(sec->fileName,sec->label,text.stripWhiteSpace());
}
else
{
warn(yyFileName,yyLineNr,"Warning: reference to unknown section %s!",sectionRef.data());
outDoc->writeBoldString(" unknown reference! ");
}
BEGIN(DocScan);
}
<DocScan>{CMD}"image"{B}+ {
BEGIN(DocImage);
}
<DocImage>[hH][tT][mM][lL] {
BEGIN(DocHtmlImageName);
}
<DocImage>[lL][aA][tT][eE][xX] {
BEGIN(DocLatexImageName);
}
<DocHtmlImageName>{FILE}|{URLMASK} {
curImageName = findAndCopyImage(stripQuotes(yytext),IT_Html);
if (!curImageName.isEmpty())
{
/*storeOutputListState();*/
outDoc->pushGeneratorState();
outDoc->disableAllBut(OutputGenerator::Html);
outDoc->writeImage(curImageName,0,0);
/*restoreOutputListState();*/
outDoc->popGeneratorState();
}
BEGIN(DocScan);
}
<DocLatexImageName>{FILE} {
curImageName = findAndCopyImage(stripQuotes(yytext),IT_Latex);
if (curImageName.isEmpty())
BEGIN(DocScan);
else
BEGIN(DocLatexImageWidth);
}
<DocLatexImageWidth>\n { // no width specified
/*storeOutputListState();*/
outDoc->pushGeneratorState();
outDoc->disableAllBut(OutputGenerator::Latex);
outDoc->writeImage(curImageName,0,0);
/*restoreOutputListState();*/
outDoc->popGeneratorState();
BEGIN(DocScan);
}
<DocLatexImageWidth>"width"{B}*"="{B}*[0-9\.]+({B}*{ID})? {
/*storeOutputListState();*/
outDoc->pushGeneratorState();
outDoc->disableAllBut(OutputGenerator::Latex);
outDoc->writeImage(curImageName,yytext,0);
/*restoreOutputListState();*/
outDoc->popGeneratorState();
BEGIN(DocScan);
}
<DocLatexImageWidth>"height"{B}*"="{B}*[0-9\.]+({B}*{ID})? {
/*storeOutputListState();*/
outDoc->pushGeneratorState();
outDoc->disableAllBut(OutputGenerator::Latex);
outDoc->writeImage(curImageName,0,yytext);
/*restoreOutputListState();*/
outDoc->popGeneratorState();
BEGIN(DocScan);
}
<DocImage>[a-z_A-Z0-9\.\-]+ {
warn(yyFileName,yyLineNr,"Warning: %s is an unsupported output format for \\image",yytext);
}
<DocImage,DocHtmlImageName,DocLatexImageName>\n {
warn(yyFileName,yyLineNr,"Warning: invalid \\image command found!");
outDoc->enableAll();
BEGIN(DocScan);
}
<DocScan>{CMD}"code"({BN}*"\n"|{B}*) {
outDoc->startCodeFragment();
codeBlock.resize(0);
BEGIN( DocCodeBlock );
}
<DocScan>{CMD}"endcode"/[^a-z_A-Z0-9] {
warn(yyFileName,yyLineNr,"Warning: \\endcode without <PRE> or \\code "
"in the documentation.");
}
<DocScan,DocRefName>{ID}"<"[^>\ \t\n]*">"("::"{ID})+"("?[a-z_A-Z0-9,:\<\> \t\*\&]*")"? {
generateRef(*outDoc,className,yytext,inSeeBlock);
BEGIN(DocScan);
}
<DocScan,DocRefName>{SCOPEMASK}"("[a-z_A-Z0-9,:\<\> \t\*\&]+")" {
generateRef(*outDoc,className,yytext,inSeeBlock);
BEGIN(DocScan);
}
<DocScan,DocRefName>{SCOPEMASK}("()")? {
generateRef(*outDoc,className,yytext,inSeeBlock);
BEGIN(DocScan);
}
<DocScan,DocRefName>({SCOPEMASK}"::")?"operator()("[a-z_A-Z0-9,\<\> \t\*\&]*")" {
QCString oName=yytext;
generateRef(*outDoc,className,
removeRedundantWhiteSpace(oName),inSeeBlock);
BEGIN(DocScan);
}
<DocScan,DocRefName>({SCOPEMASK}"::")?"operator"[^(\r\n.,]+"("[a-z_A-Z0-9,\<\> \t\*\&]*")" {
QCString oName=yytext;
generateRef(*outDoc,className,
removeRedundantWhiteSpace(oName),inSeeBlock);
BEGIN(DocScan);
}
<DocScan>("http:"|"https:"|"ftp:"|"file:"){URLMASK} { outDoc->writeHtmlLink(yytext,yytext); }
<DocScan>[a-zA-Z_0-9\.\-]+"@"[0-9a-z_A-Z\.\-]+ { outDoc->writeMailLink(yytext); }
<DocScan>{FILEMASK} {
generateFileRef(*outDoc,yytext);
}
<DocCodeBlock>{BN}*{CMD}"endcode"/[^a-z_A-Z0-9] { // needed to match things like \endcode. (note the dot)
parseCode(*outDoc,className,codeBlock,exampleDoc,exampleName);
//printf("Code block\n-------------\n%s\n--------------\n",codeBlock.data());
outDoc->endCodeFragment();
BEGIN( DocScan );
}
<DocCodeBlock>"</"{PRE}{ATTR}">" {
parseCode(*outDoc,className,codeBlock,exampleDoc,exampleName);
//printf("Code block\n-------------\n%s\n--------------\n",codeBlock.data());
outDoc->endCodeFragment();
BEGIN( DocScan );
}
<DocScan>{CMD}("e"|"em"|"a"){BN}+ { BEGIN( DocEmphasis ); }
<DocScan>{CMD}"b"{BN}+ { BEGIN( DocBold ); }
<DocScan>{CMD}("c"|"p"){BN}+ { BEGIN( DocCode ); }
<DocScan>{CMD}"l"{BN}+
<DocScan>"\\n"/[^a-z_A-Z0-9] { outDoc->lineBreak(); }
<DocScan>{CMD}"include"{BN}+ { BEGIN( DocInclude ); }
<DocScan>{CMD}"dontinclude"{BN}+ { BEGIN( DocDontInclude ); }
<DocScan>{CMD}"skip"{BN}+ { BEGIN( DocSkipKey ); }
<DocScan>{CMD}"skipline"{BN}+ { BEGIN( DocSkiplineKey ); firstLine=TRUE; }
<DocScan>{CMD}"line"{BN}+ { BEGIN( DocLineKey ); firstLine=TRUE; }
<DocScan>{CMD}"until"{BN}+ { BEGIN( DocUntilKey ); firstLine=TRUE; }
<DocSkipKey>[^ \t\r\n]+ {
if (includeFileLength>0)
skipUntil(yytext);
BEGIN( DocScan );
}
<DocLineKey>[^ \t\r\n]+ {
if (includeFileLength>0)
{
if (firstLine) outDoc->startCodeFragment();
firstLine=FALSE;
showLine(*outDoc,yytext);
BEGIN( DocKeyEnd );
}
else
{
BEGIN( DocScan );
}
}
<DocSkiplineKey>[^ \t\r\n]+ {
if (includeFileLength>0)
{
if (firstLine) outDoc->startCodeFragment();
firstLine=FALSE;
skipLine(*outDoc,yytext);
BEGIN( DocKeyEnd );
}
else
{
BEGIN( DocScan );
}
}
<DocUntilKey>[^ \t\r\n]+ {
if (includeFileLength>0)
{
if (firstLine) outDoc->startCodeFragment();
firstLine=FALSE;
showUntil(*outDoc,yytext);
BEGIN( DocKeyEnd );
}
else
{
BEGIN( DocScan );
}
}
<DocKeyEnd>{CMD}"line"{BN}+ { BEGIN(DocLineKey); }
<DocKeyEnd>{CMD}"until"{BN}+ { BEGIN(DocUntilKey); }
<DocKeyEnd>{CMD}"skipline"{BN}+ { BEGIN(DocSkiplineKey); }
<DocKeyEnd>\n
<DocKeyEnd><<EOF>> {
if (!firstLine) outDoc->endCodeFragment();
yyterminate();
}
<DocKeyEnd>. {
unput(*yytext);
if (!firstLine) outDoc->endCodeFragment();
BEGIN( DocScan );
}
<DocScan>"<"{MULTICOL}{ATTR}">"
<DocScan>"</"{MULTICOL}{ATTR}">"
<DocScan>"<"{STRONG}{ATTR}">" { outDoc->startBold(); }
<DocScan>"</"{STRONG}{ATTR}">" { outDoc->endBold(); }
<DocScan>"<"{CENTER}{ATTR}">" { outDoc->startCenter(); }
<DocScan>"</"{CENTER}{ATTR}">" { outDoc->endCenter(); }
<DocScan>"<"{TABLE}{ATTR}">" { startTable(); }
<DocScan>"</"{TABLE}{ATTR}">" { endTable(); }
<DocScan>"<"{INPUT}{ATTR}">"
<DocScan>"<"{SMALL}{ATTR}">" { outDoc->startSmall(); }
<DocScan>"</"{SMALL}{ATTR}">" { outDoc->endSmall(); }
<DocScan>"<"{META}{ATTR}">"
<DocScan>"<"{FORM}{ATTR}">"
<DocScan>"</"{FORM}{ATTR}">"
<DocScan>"<"{HEAD}{ATTR}">"
<DocScan>"</"{HEAD}{ATTR}">"
<DocScan>"<"{BODY}{ATTR}">"
<DocScan>"</"{BODY}{ATTR}">"
<DocScan>"<"{CODE}{ATTR}">" { outDoc->startTypewriter(); }
<DocScan>"</"{CODE}{ATTR}">" { outDoc->endTypewriter(); }
<DocScan>"<"{DFN}{ATTR}">" { outDoc->startTypewriter(); }
<DocScan>"</"{DFN}{ATTR}">" { outDoc->endTypewriter(); }
<DocScan>"<"{VAR}{ATTR}">" { outDoc->startEmphasis(); }
<DocScan>"</"{VAR}{ATTR}">" { outDoc->endEmphasis(); }
<DocScan>"<"{IMG}{ATTR}">" {
/*storeOutputListState();*/
outDoc->pushGeneratorState();
outDoc->disableAllBut(OutputGenerator::Html);
outDoc->writeString(yytext);
/*restoreOutputListState();*/
outDoc->popGeneratorState();
}
<DocScan>"<"{PRE}{ATTR}">" {
outDoc->startCodeFragment();
codeBlock.resize(0);
BEGIN( DocCodeBlock );
}
<DocScan>"</"{PRE}{ATTR}">" {
warn(yyFileName,yyLineNr,
"Warning: </PRE> without <PRE> or \\code"
"in the documentation."
);
}
<DocScan>"<"{SUB}{ATTR}">" { outDoc->startSubscript(); }
<DocScan>"</"{SUB}{ATTR}">" { outDoc->endSubscript(); }
<DocScan>"<"{SUP}{ATTR}">" { outDoc->startSuperscript(); }
<DocScan>"</"{SUP}{ATTR}">" { outDoc->endSuperscript(); }
<DocScan>"<"{TR}{ATTR}">" { if (curTable) curTable->newRow(); }
<DocScan>"</"{TR}{ATTR}">"
<DocScan>"<"{TD}{ATTR}">" { if (curTable) curTable->newElem(); }
<DocScan>"</"{TD}{ATTR}">"
<DocScan>"<"{OL}{ATTR}">" { outDoc->startEnumList();
currentListIndentLevel++;
}
<DocScan>"</"{OL}{ATTR}">" {
if (currentListIndentLevel<=0)
{
warn(yyFileName,yyLineNr,
"Warning: more </ol> tags than <ol> tags in the documentation."
);
}
else
{
outDoc->endEnumList();
currentListIndentLevel--;
}
}
<DocScan>"<"{UL}{ATTR}">" { outDoc->startItemList();
currentListIndentLevel++;
}
<DocScan>"</"{UL}{ATTR}">" {
if (currentListIndentLevel<=0)
{
warn(yyFileName,yyLineNr,
"Warning: more </ul> tags than <ul> tags in the documentation."
);
}
else
{
outDoc->endItemList();
currentListIndentLevel--;
}
}
<DocScan>"<"{LI}{ATTR}">" { outDoc->writeListItem(); }
<DocScan>"</"{LI}{ATTR}">"
<DocScan>"<"{TT}{ATTR}">" { outDoc->startTypewriter(); }
<DocScan>"</"{TT}{ATTR}">" { outDoc->endTypewriter(); }
<DocScan>"<"{EM}{ATTR}">" { outDoc->startEmphasis(); }
<DocScan>"</"{EM}{ATTR}">" { outDoc->endEmphasis(); }
<DocScan>"<"{HR}{ATTR}">" { outDoc->writeRuler(); }
<DocScan>"<"{DL}{ATTR}">" { outDoc->startDescription();
currentListIndentLevel++;
}
<DocScan>"</"{DL}{ATTR}">" {
if (currentListIndentLevel<=0)
{
warn(yyFileName,yyLineNr,
"Warning: more </dl> tags than <dl> tags in the documentation."
);
}
else
{
outDoc->endDescription();
currentListIndentLevel--;
}
}
<DocScan>"<"{DT}{ATTR}">" { outDoc->startDescItem(); }
<DocScan>"</"{DT}{ATTR}">"
<DocScan>"<"{DD}{ATTR}">" { outDoc->endDescItem(); }
<DocScan>"</"{DD}{ATTR}">"
<DocScan>"<"{BR}{ATTR}">" { outDoc->lineBreak(); }
<DocScan>"<"{I}{ATTR}">" { outDoc->startEmphasis(); }
<DocScan>"</"{I}{ATTR}">" { outDoc->endEmphasis(); }
<DocScan>"</"{A}{ATTR}">"
<DocScan>"<"{A} { BEGIN(DocHtmlLink); }
<DocScan>"<"{BOLD}{ATTR}">" { outDoc->startBold(); }
<DocScan>"</"{BOLD}{ATTR}">" { outDoc->endBold(); }
<DocScan>"<"{P}{ATTR}">" {
if (inBlock()) endBlock();
outDoc->newParagraph(); }
<DocScan>"</"{P}{ATTR}">"
<DocScan>"<"{H1}{ATTR}">" { outDoc->startTitle(); }
<DocScan>"</"{H1}{ATTR}">" { outDoc->endTitle(); }
<DocScan>"<"{H2}{ATTR}">" { outDoc->startSubsection(); }
<DocScan>"</"{H2}{ATTR}">" { outDoc->endSubsection(); }
<DocScan>"<"{H3}{ATTR}">" { outDoc->startSubsubsection(); }
<DocScan>"</"{H3}{ATTR}">" { outDoc->endSubsubsection(); }
<DocHtmlLink>{NAME}{BN}*"="{BN}*("\""?) { BEGIN(DocHtmlAnchor); }
<DocHtmlAnchor>[a-z_A-Z0-9.\-\+\/]+ { outDoc->writeAnchor(0,yytext); }
<DocHtmlLink>{HREF}{BN}*"="{BN}*("\""?) {
htmlUrl.resize(0);
htmlText.resize(0);
BEGIN(DocHtmlHref1); }
<DocHtmlHref1>{URLMASK} {
htmlUrl=yytext;
}
<DocHtmlHref1>">" { BEGIN(DocHtmlHref2); }
<DocHtmlHref2>[^<]* { htmlText+=yytext; }
/*
<DocHtmlHref2>\n { htmlText+='\n'; }
*/
<DocHtmlHref2>"<" {
outDoc->writeHtmlLink(htmlUrl,htmlText);
unput(*yytext);
BEGIN(DocScan);
}
<DocHtmlLink,DocHtmlAnchor>">" { BEGIN(DocScan); }
<DocScan>{CMD}("\\"|"@"|"<"|">"|"&"|"$"|"#"|"%") {
outDoc->docify(&yytext[1]);
}
<DocScan>"%"[a-zA-Z_0-9\-]+ {
outDoc->docify(yytext+1);
}
<DocEmphasis>[a-z_A-Z][a-z_A-Z:0-9<>&\-=^%~!\[\]()|\*/]*"("[a-z_A-Z0-9,:\<\> \t\*\&]*")" {
outDoc->startEmphasis();
generateRef(*outDoc,className,yytext,inSeeBlock);
outDoc->endEmphasis();
BEGIN( DocScan );
}
<DocEmphasis>{WORD} {
outDoc->startEmphasis();
linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE);
outDoc->endEmphasis();
BEGIN( DocScan );
}
<DocBold>[a-z_A-Z][a-z_A-Z:0-9<>&\-=^%~!\[\]()|\*/]*"("[a-z_A-Z0-9,:\<\> \t\*\&]*")" {
outDoc->startBold();
generateRef(*outDoc,className,yytext,inSeeBlock);
outDoc->endBold();
BEGIN( DocScan );
}
<DocBold>{WORD} {
outDoc->startBold();
linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE);
outDoc->endBold();
BEGIN( DocScan );
}
<DocCode>[a-z_A-Z][a-z_A-Z:0-9<>&\-=^%~!\[\]()!\*/]*"("[a-z_A-Z0-9,:\<\> \t\*\&]*")" {
outDoc->startTypewriter();
generateRef(*outDoc,className,yytext,inSeeBlock);
outDoc->endTypewriter();
BEGIN( DocScan );
}
<DocCode>{WORD} {
outDoc->startTypewriter();
linkifyText(TextGeneratorOLImpl(*outDoc),className,0,yytext,FALSE,FALSE);
outDoc->endTypewriter();
BEGIN( DocScan );
}
<DocInclude>{FILE} {
includeFile(*outDoc,stripQuotes(yytext),FALSE);
BEGIN( DocScan );
}
<DocDontInclude>{FILE} {
includeFile(*outDoc,stripQuotes(yytext),TRUE);
BEGIN( DocScan );
}
<DocCodeBlock>"//" { codeBlock += yytext; }
<DocCodeBlock>"/*" { codeBlock += yytext; }
<DocCodeBlock>\n { codeBlock += '\n'; }
<DocCodeBlock>[^\/\\\<\n]* { codeBlock += yytext; }
<DocCodeBlock>. { codeBlock += *yytext; }
<DocCode,DocEmphasis,DocScan,DocBold>"//" {
outDoc->docify(yytext);
}
<DocCode,DocEmphasis,DocScan,DocBold>"/*" {
outDoc->docify(yytext);
}
<DocCode,DocEmphasis,DocBold>"\n" { outDoc->writeChar('\n'); }
<DocScan>({B}*"\n"){2,}{B}*"*"*{B}*"-"("#")?{B}+ { // new paragraph & start of a list
QCString text=yytext;
int dashPos = text.findRev('-');
bool isEnumerated = text.at(dashPos+1)=='#';
if (insideArgumentList)
{
insideArgumentList=FALSE;
outDoc->endItemList();
}
else if (insideItemList)
{
forceEndItemList();
}
else
{
outDoc->newParagraph();
}
if (inBlock()) endBlock();
addListItemMarker(strrchr(yytext,'\n')+1,dashPos,isEnumerated);
}
<DocScan>({B}*"\n"){2,}{B}* { // new paragraph
if (insideArgumentList)
{
insideArgumentList=FALSE;
outDoc->endItemList();
}
else if (insideItemList)
{ {
forceEndItemList(); warn(yyFileName,yyLineNr,"Warning: Missing //@}");
memberGroupId=NOGROUP;
} }
else yyLineNr= 0 ; // there is always an extra newline at the start of the file
int i;
for( i = 0 ; yytext[i+1] != 6 ; i++ )
yyFileName[i] = yytext[i+1] ;
yyFileName[i] = 0 ;
insideIDL = i>4 && strcmp(&yyFileName[i-4],".idl")==0;
msg("Parsing file %s...\n",yyFileName);
current_root = global_root ;
initParser();
current->reset();
int sec=guessSection(yyFileName);
if (sec)
{ {
outDoc->newParagraph(); current->name = yyFileName;
current->name = current->name;
current->section = sec;
current_root->addSubEntry(current);
current = new Entry;
} }
if (inBlock()) endBlock(); BEGIN( FindMembers );
}
<DocScan>{BN}+/\n {
outDoc->writeChar(' ');
}
<DocScan>\n?{B}* {
outDoc->writeChar(' ');
}
<DocCode,DocEmphasis,DocBold,DocScan,Text>[a-z_A-Z0-9]+ {
outDoc->docify(yytext);
}
<DocCode,DocEmphasis,DocBold,DocScan,Text>. {
outDoc->writeChar(*yytext);
} }
<*>\x0d
<NextSemi>"{" { <NextSemi>"{" {
curlyCount=0; curlyCount=0;
BEGIN(SkipCurlyBlock); BEGIN(SkipCurlyBlock);
...@@ -2697,19 +831,6 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") ...@@ -2697,19 +831,6 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"")
else else
BEGIN( EndTemplate ); BEGIN( EndTemplate );
} }
/*
<SkipTemplate>"<" {
sharpCount++;
}
<SkipTemplate>">" {
if (--sharpCount<=0)
{
BEGIN(FindMembers);
}
}
<SkipTemplate>.
*/
<EndTemplate>"<" { <EndTemplate>"<" {
current->name+='<'; current->name+='<';
*currentTemplateSpec+='<'; *currentTemplateSpec+='<';
...@@ -4447,12 +2568,14 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") ...@@ -4447,12 +2568,14 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"")
todoStartContext = YY_START; todoStartContext = YY_START;
lastBriefContext = TodoParam; // this is where we will continue at the end of the argument lastBriefContext = TodoParam; // this is where we will continue at the end of the argument
todoString = current->brief.copy(); // these will be swapped later on. todoString = current->brief.copy(); // these will be swapped later on.
current->brief.resize(0);
BEGIN(ClassDocBrief); BEGIN(ClassDocBrief);
} }
<AfterDoc,AfterDocLine,LineDoc,Doc,JavaDoc,ClassDoc,PageDoc>{CMD}"test"/[^a-z_A-Z0-9] { <AfterDoc,AfterDocLine,LineDoc,Doc,JavaDoc,ClassDoc,PageDoc>{CMD}"test"/[^a-z_A-Z0-9] {
testStartContext = YY_START; testStartContext = YY_START;
lastBriefContext = TestParam; // this is where we will continue at the end of the argument lastBriefContext = TestParam; // this is where we will continue at the end of the argument
testString = current->brief.copy(); // these will be swapped later on. testString = current->brief.copy(); // these will be swapped later on.
current->brief.resize(0);
BEGIN(ClassDocBrief); BEGIN(ClassDocBrief);
} }
<TodoParam>\n | <TodoParam>\n |
...@@ -4807,11 +2930,13 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") ...@@ -4807,11 +2930,13 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"")
<Doc,JavaDoc,LineDoc,ExampleDoc,ClassDocBrief,PageDoc,ClassDoc,AfterDoc,AfterDocLine,AfterDocBrief>{CMD}"f$" { <Doc,JavaDoc,LineDoc,ExampleDoc,ClassDocBrief,PageDoc,ClassDoc,AfterDoc,AfterDocLine,AfterDocBrief>{CMD}"f$" {
lastFormulaContext = YY_START; lastFormulaContext = YY_START;
formulaText="$"; formulaText="$";
insideFormula=TRUE;
BEGIN(ReadFormulaShort); BEGIN(ReadFormulaShort);
} }
<Doc,JavaDoc,LineDoc,ExampleDoc,ClassDocBrief,PageDoc,ClassDoc,AfterDoc,AfterDocLine,AfterDocBrief>{CMD}"f[" { <Doc,JavaDoc,LineDoc,ExampleDoc,ClassDocBrief,PageDoc,ClassDoc,AfterDoc,AfterDocLine,AfterDocBrief>{CMD}"f[" {
lastFormulaContext = YY_START; lastFormulaContext = YY_START;
formulaText="\\["; formulaText="\\[";
insideFormula=TRUE;
BEGIN(ReadFormulaLong); BEGIN(ReadFormulaLong);
} }
<ReadFormulaShort>{CMD}"f$" { <ReadFormulaShort>{CMD}"f$" {
...@@ -4825,8 +2950,20 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") ...@@ -4825,8 +2950,20 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"")
current->brief += addFormula(); current->brief += addFormula();
else else
current->doc += addFormula(); current->doc += addFormula();
insideFormula=FALSE;
BEGIN(lastFormulaContext); BEGIN(lastFormulaContext);
} }
<ReadFormulaShort>\n {
formulaText+=" ";
if (lastFormulaContext==LineDoc ||
lastFormulaContext==AfterDocLine
)
{
checkFormula();
insideFormula=FALSE;
BEGIN(lastFormulaContext);
}
}
<ReadFormulaLong>{CMD}"f]" { <ReadFormulaLong>{CMD}"f]" {
formulaText+="\\]"; formulaText+="\\]";
if (lastFormulaContext==ClassDocBrief || if (lastFormulaContext==ClassDocBrief ||
...@@ -4838,10 +2975,11 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") ...@@ -4838,10 +2975,11 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"")
current->brief += addFormula(); current->brief += addFormula();
else else
current->doc += addFormula(); current->doc += addFormula();
insideFormula=FALSE;
BEGIN(lastFormulaContext); BEGIN(lastFormulaContext);
} }
<ReadFormulaLong,ReadFormulaShort>. { formulaText+=*yytext; } <ReadFormulaLong,ReadFormulaShort>. { formulaText+=*yytext; }
<ExampleDoc,PageDoc,ClassDocBrief,SkipCode,ClassDoc>{B}*"*/" { <ExampleDoc,PageDoc,ClassDocBrief,SkipCode,ClassDoc,ReadFormulaShort,ReadFormulaLong>{B}*"*/" {
checkDocs(); checkDocs();
//printf("current->section=%x\n",current->section); //printf("current->section=%x\n",current->section);
if (YY_START==SkipCode) // premature end of code block if (YY_START==SkipCode) // premature end of code block
...@@ -5210,59 +3348,6 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") ...@@ -5210,59 +3348,6 @@ DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"")
} }
%% %%
//----------------------------------------------------------------------------
//static void addToBody(const char *text)
//{
// if (Config::includeSourceFlag)
// previous->body+=text;
//}
//static void addToBodyCond(const char *text)
//{
// if (Config::includeSourceFlag && lastStringContext==SkipCurly)
// previous->body+=text;
//}
//----------------------------------------------------------------------------
void scanString(const char *s)
{
const char *oldInputString = inputString;
int oldInputPosition = inputPosition;
int oldRule = YY_START;
YY_BUFFER_STATE oldBuffer = YY_CURRENT_BUFFER;
yy_switch_to_buffer(yy_create_buffer(scanYYin, YY_BUF_SIZE));
inputString = s;
inputPosition = 0;
BEGIN( Text );
scanYYlex();
yy_delete_buffer(YY_CURRENT_BUFFER);
yy_switch_to_buffer(oldBuffer);
inputString = oldInputString;
inputPosition = oldInputPosition;
BEGIN( oldRule );
}
void internalParseDocument(const char *s)
{
const char *oldInputString = inputString;
int oldInputPosition = inputPosition;
int oldRule = YY_START;
YY_BUFFER_STATE oldBuffer = YY_CURRENT_BUFFER;
yy_switch_to_buffer(yy_create_buffer(scanYYin, YY_BUF_SIZE));
inputString = s;
inputPosition = 0;
BEGIN( DocScan );
scanYYlex();
yy_delete_buffer(YY_CURRENT_BUFFER);
yy_switch_to_buffer(oldBuffer);
inputString = oldInputString;
inputPosition = oldInputPosition;
BEGIN( oldRule );
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static void newDocState() static void newDocState()
...@@ -5280,7 +3365,7 @@ static void newDocState() ...@@ -5280,7 +3365,7 @@ static void newDocState()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void parseCompounds(Entry *rt) static void parseCompounds(Entry *rt)
{ {
//printf("parseCompounds(%s)\n",rt->name.data()); //printf("parseCompounds(%s)\n",rt->name.data());
EntryListIterator eli(*rt->sublist); EntryListIterator eli(*rt->sublist);
...@@ -5352,102 +3437,6 @@ void parseMain(Entry *rt) ...@@ -5352,102 +3437,6 @@ void parseMain(Entry *rt)
parseCompounds(rt); parseCompounds(rt);
} }
//----------------------------------------------------------------------------
void parseDocument(OutputList &ol,const QCString &docString)
{
//inParamBlock=inSeeBlock=inReturnBlock=FALSE;
curTable = 0;
depthIf = 0;
outDoc = new OutputList(&ol);
currentIncludeFile.resize(0);
includeFileOffset=0;
includeFileLength=0;
currentListIndentLevel=0;
if (!docString) return;
linkRef = "";
linkText = "";
inputString = docString;
inputPosition = 0;
scanYYrestart( scanYYin );
BEGIN( DocScan );
insideArgumentList = FALSE;
insideVerbatim = FALSE;
scanYYlex();
if (insideArgumentList) { insideArgumentList=FALSE; outDoc->endItemList(); }
if (insideItemList) { forceEndItemList(); }
if (inBlock()) endBlock();
if (currentListIndentLevel>0)
{
warn(yyFileName,yyLineNr,"Warning: Documentation ended in the middle "
"of a list (indent level %d)!",currentListIndentLevel);
}
if (depthIf!=0)
{
warn(yyFileName,yyLineNr,"Warning: Documentation block contains \\if "
"without matching \\endif: nesting level is %d",depthIf);
}
if (!tableStack.isEmpty())
{
forceEndTable();
}
if (insideVerbatim)
{
warn(yyFileName,yyLineNr,
"Warning: file ended inside a \\verbatim block!"
);
}
ol+=*outDoc;
delete outDoc; outDoc=0;
return;
}
//----------------------------------------------------------------------------
void parseDoc(OutputList &ol,const char *fileName,int startLine,
const char *clName,const char *memName,const QCString &docString)
{
//printf("parseDoc(file=`%s',line=%d)\n",fileName,startLine);
initParser();
initParseCodeContext();
exampleDoc=FALSE; // do not cross reference with member docs
className=clName;
memberName=memName;
strcpy(yyFileName,fileName);
yyLineNr = startLine;
parseDocument(ol,docString);
}
//----------------------------------------------------------------------------
void parseText(OutputList &ol,const QCString &txtString)
{
if (txtString.isEmpty()) return;
inputString = txtString;
outDoc = new OutputList(&ol);
inputPosition = 0;
scanYYrestart( scanYYin );
BEGIN( Text );
scanYYlex();
ol+=*outDoc;
delete outDoc; outDoc=0;
return;
}
//----------------------------------------------------------------------------
void parseExample(OutputList &ol,const QCString &docString,
const char *fileName)
{
initParser();
initParseCodeContext();
exampleDoc=TRUE; // cross reference with member docs
exampleName=fileName;
strcpy(yyFileName,fileName);
parseDocument(ol,docString);
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
extern "C" { // some bogus code to keep the compiler happy extern "C" { // some bogus code to keep the compiler happy
void scannerYYdummy() { yy_flex_realloc(0,0); } void scannerYYdummy() { yy_flex_realloc(0,0); }
......
...@@ -982,12 +982,12 @@ class Translator ...@@ -982,12 +982,12 @@ class Translator
// new since 1.2.0 // new since 1.2.0
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/*! Used as a marker that is put before a todo item */ /*! Used as a marker that is put before a test item */
virtual QCString trTest() virtual QCString trTest()
{ {
return "Test"; return "Test";
} }
/*! Used as the header of the todo list */ /*! Used as the header of the test list */
virtual QCString trTestList() virtual QCString trTestList()
{ {
return "Test List"; return "Test List";
......
...@@ -45,6 +45,9 @@ ...@@ -45,6 +45,9 @@
// - Encoding conversion tables moved to the methods that use them. // - Encoding conversion tables moved to the methods that use them.
// - Updates for "new since 1.1.5". // - Updates for "new since 1.1.5".
// //
// 2000/08/02 (Petr Prikryl)
// - Updated for 1.2.0
//
// Notices: // Notices:
// -------- // --------
// The conditional compilation ensures or the neutral functionality // The conditional compilation ensures or the neutral functionality
...@@ -1128,6 +1131,23 @@ class TranslatorCzech : public Translator ...@@ -1128,6 +1131,23 @@ class TranslatorCzech : public Translator
{ {
return DECODE("vysvìtlivky"); return DECODE("vysvìtlivky");
} }
//////////////////////////////////////////////////////////////////////////
// new since 1.2.0
//////////////////////////////////////////////////////////////////////////
/*! Used as a marker that is put before a test item */
virtual QCString trTest()
{
return "Test";
}
/*! Used as the header of the test list */
virtual QCString trTestList()
{
return "Seznam testù";
}
}; };
#endif // TRANSLATOR_CZ_H #endif // TRANSLATOR_CZ_H
...@@ -716,6 +716,244 @@ class TranslatorFrench : public Translator ...@@ -716,6 +716,244 @@ class TranslatorFrench : public Translator
{ {
return "Définition dans le fichier @0."; return "Définition dans le fichier @0.";
} }
//////////////////////////////////////////////////////////////////////////
// new since 0.49-991205
//////////////////////////////////////////////////////////////////////////
virtual QCString trDeprecated()
{
return "Obsolète";
}
//////////////////////////////////////////////////////////////////////////
// new since 1.0.0
//////////////////////////////////////////////////////////////////////////
/*! this text is put before a collaboration diagram */
virtual QCString trCollaborationDiagram(const char *clName)
{
return (QCString)"Diagramme de collaboration de "+clName+":";
}
/*! this text is put before an include dependency graph */
virtual QCString trInclDepGraph(const char *fName)
{
return (QCString)"Graphe des dépendances par inclusion pour "+fName+":";
}
/*! header that is put before the list of constructor/destructors. */
virtual QCString trConstructorDocumentation()
{
return "Documentation des contructeurs et destructeurs";
}
/*! Used in the file documentation to point to the corresponding sources. */
virtual QCString trGotoSourceCode()
{
return "Aller au code source de ce fichier.";
}
/*! Used in the file sources to point to the corresponding documentation. */
virtual QCString trGotoDocumentation()
{
return "Aller à la documentation de ce fichier.";
}
/*! Text for the \pre command */
virtual QCString trPrecondition()
{
return "Précondition";
}
/*! Text for the \post command */
virtual QCString trPostcondition()
{
return "Postcondition";
}
/*! Text for the \invariant command */
virtual QCString trInvariant()
{
return "Invariant";
}
/*! Text shown before a multi-line variable/enum initialization */
virtual QCString trInitialValue()
{
return "Initialisation:";
}
/*! Text used the source code in the file index */
virtual QCString trCode()
{
return "code";
}
virtual QCString trGraphicalHierarchy()
{
return "Diagramme hiérarchique des classes";
}
virtual QCString trGotoGraphicalHierarchy()
{
return "Aller au diagramme hiérarchique des classes";
}
virtual QCString trGotoTextualHierarchy()
{
return "Aller à la hiérarchie des classes en texte";
}
virtual QCString trPageIndex()
{
return "Index des pages";
}
//////////////////////////////////////////////////////////////////////////
// new since 1.1.0
//////////////////////////////////////////////////////////////////////////
virtual QCString trNote()
{
return "Note";
}
virtual QCString trPublicTypes()
{
return "Types Publics";
}
virtual QCString trPublicAttribs()
{
return "Attributs Publics";
}
virtual QCString trStaticPublicAttribs()
{
return "Attributs Publics Statiques";
}
virtual QCString trProtectedTypes()
{
return "Types Protégés";
}
virtual QCString trProtectedAttribs()
{
return "Attributs Protégés";
}
virtual QCString trStaticProtectedAttribs()
{
return "Attributs Protégés Statiques";
}
virtual QCString trPrivateTypes()
{
return "Types Privés";
}
virtual QCString trPrivateAttribs()
{
return "Attributs Privés";
}
virtual QCString trStaticPrivateAttribs()
{
return "Attributs Privés Statiques";
}
//////////////////////////////////////////////////////////////////////////
// new since 1.1.3
//////////////////////////////////////////////////////////////////////////
/*! Used as a marker that is put before a todo item */
virtual QCString trTodo()
{
return "A Faire";
}
/*! Used as the header of the todo list */
virtual QCString trTodoList()
{
return "Liste des choses à faire";
}
//////////////////////////////////////////////////////////////////////////
// new since 1.1.4
//////////////////////////////////////////////////////////////////////////
virtual QCString trReferencedBy()
{
return "Référencé par";
}
virtual QCString trRemarks()
{
return "Remarques";
}
virtual QCString trAttention()
{
return "Attention";
}
virtual QCString trInclByDepGraph()
{
return "Ce graphe montre quels fichiers incluent directement "
"ou indirectement ce fichier:";
}
virtual QCString trSince()
{
return "Depuis";
}
//////////////////////////////////////////////////////////////////////////
// new since 1.1.5
//////////////////////////////////////////////////////////////////////////
/*! title of the graph legend page */
virtual QCString trLegendTitle()
{
return "Légende du graphe";
}
/*! page explaining how the dot graph's should be interpreted */
virtual QCString trLegendDocs()
{
return
"Cette page explique comment interpréter les graphes générés "
"par doxygen.<p>\n"
"Considérez l'exemple suivant:\n"
"\\code\n"
"/*! Classe invisible à cause d'une troncature */\n"
"class Invisible { };\n\n"
"/*! Classe tronquée, la relation d'héritage est masquée */\n"
"class Truncated : public Invisible { };\n\n"
"/*! Classe non documentée avec des commentaires Doxygen */\n"
"class Undocumented { };\n\n"
"/*! Classe dérivée par héritage public */\n"
"class PublicBase : public Truncated { };\n\n"
"/*! Classe dérivée par héritage protégé */\n"
"class ProtectedBase { };\n\n"
"/*! Classe dérivée par héritage privé */\n"
"class PrivateBase { };\n\n"
"/*! Classe utilisée par la classe dérivée */\n"
"class Used { };\n\n"
"/*! Super-classe qui hérite de plusieurs autres classes */\n"
"class Inherited : public PublicBase,\n"
" protected ProtectedBase,\n"
" private PrivateBase,\n"
" public Undocumented\n"
"{\n"
" private:\n"
" Used *m_usedClass;\n"
"};\n"
"\\endcode\n"
"Si la valeur 200 est attribuée au tag \\c MAX_DOT_GRAPH_HEIGHT "
"du fichier de configuration, cela génèrera le graphe suivant:"
"<p><center><img src=\"graph_legend.gif\"></center>\n"
"<p>\n"
"Les rectangles du graphe ci-dessus ont la signification suivante:\n"
"<ul>\n"
"<li>Un rectangle plein noir représente la structure ou la classe pour laquelle "
"le graphe est généré.\n"
"<li>Un rectangle avec un bord noir indique une classe ou une structure documentée.\n"
"<li>Un rectangle avec un bord gris indique une classe ou une structure non documentée.\n"
"<li>Un rectangle avec un bord rouge indique une structure ou une classe documentée\n"
"pour laquelle des relations d'héritage ou de collaboration manquent. Un graphe est "
"tronqué s'il ne rentre pas dans les limites spécifiées."
"</ul>\n"
"Les flèches ont la signification suivante:\n"
"<ul>\n"
"<li>Une flèche bleu foncé est utilisée pour visuliser une relation d'héritage public "
"entre deux classes.\n"
"<li>Une flèche vert foncé est utilisée pour une relation d'héritage protégé.\n"
"<li>Une flèche rouge foncé est utilisée pour une relation d'héritage privé.\n"
"<li>Une fléche violette en pointillés est utilisée si une classe est contenue ou "
"utilisée par une autre classe. La flèche est étiquetée avec la ou les variable(s) "
"qui permettent d'acceder à la classe ou structure pointée. \n"
"</ul>\n";
}
/*! text for the link to the legend page */
virtual QCString trLegend()
{
return "Légende";
}
}; };
#endif #endif
...@@ -701,12 +701,12 @@ class TranslatorDutch : public Translator ...@@ -701,12 +701,12 @@ class TranslatorDutch : public Translator
// new since 1.2.0 // new since 1.2.0
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/*! Used as a marker that is put before a todo item */ /*! Used as a marker that is put before a test item */
virtual QCString trTest() virtual QCString trTest()
{ {
return "Test"; return "Test";
} }
/*! Used as the header of the todo list */ /*! Used as the header of the test list */
virtual QCString trTestList() virtual QCString trTestList()
{ {
return "Test Lijst"; return "Test Lijst";
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "classdef.h" #include "classdef.h"
#include "filedef.h" #include "filedef.h"
#include "doxygen.h" #include "doxygen.h"
#include "scanner.h" #include "doc.h"
#include "outputlist.h" #include "outputlist.h"
#include "defargs.h" #include "defargs.h"
#include "language.h" #include "language.h"
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "example.h" #include "example.h"
#include "version.h" #include "version.h"
#include "groupdef.h" #include "groupdef.h"
#include "xml.h"
#ifndef _WIN32 #ifndef _WIN32
#include <unistd.h> #include <unistd.h>
...@@ -46,6 +47,63 @@ ...@@ -46,6 +47,63 @@
extern char **environ; extern char **environ;
#endif #endif
//------------------------------------------------------------------------
// TextGeneratorOLImpl implementation
//------------------------------------------------------------------------
TextGeneratorOLImpl::TextGeneratorOLImpl(OutputList &ol) : m_ol(ol) {}
void TextGeneratorOLImpl::writeString(const char *s) const
{
m_ol.docify(s);
}
void TextGeneratorOLImpl::writeBreak() const
{
m_ol.pushGeneratorState();
m_ol.disableAllBut(OutputGenerator::Html);
m_ol.lineBreak();
m_ol.popGeneratorState();
}
void TextGeneratorOLImpl::writeLink(const char *extRef,const char *file,
const char *anchor,const char *text
) const
{
m_ol.writeObjectLink(extRef,file,anchor,text);
}
//------------------------------------------------------------------------
// TextGeneratorXMLImpl implementation
//------------------------------------------------------------------------
TextGeneratorXMLImpl::TextGeneratorXMLImpl(QTextStream &t) : m_t(t)
{
}
void TextGeneratorXMLImpl::writeString(const char *s) const
{
writeXMLString(m_t,s);
}
void TextGeneratorXMLImpl::writeBreak() const
{
}
void TextGeneratorXMLImpl::writeLink(const char *extRef,const char *file,
const char *anchor,const char *text
) const
{
if (extRef==0)
{ writeXMLLink(m_t,file,anchor,text); }
else // external references are not supported for XML
{ writeXMLString(m_t,text); }
}
//------------------------------------------------------------------------
//------------------------------------------------------------------------
/*! Implements an interruptable system call on Unix */ /*! Implements an interruptable system call on Unix */
int iSystem(const char *command) int iSystem(const char *command)
{ {
...@@ -1483,7 +1541,8 @@ void mergeArguments(ArgumentList *srcAl,ArgumentList *dstAl) ...@@ -1483,7 +1541,8 @@ void mergeArguments(ArgumentList *srcAl,ArgumentList *dstAl)
bool getDefs(const QCString &scName,const QCString &memberName, bool getDefs(const QCString &scName,const QCString &memberName,
const char *args, const char *args,
MemberDef *&md, MemberDef *&md,
ClassDef *&cd, FileDef *&fd, NamespaceDef *&nd, GroupDef *&gd) ClassDef *&cd, FileDef *&fd, NamespaceDef *&nd, GroupDef *&gd,
bool forceEmptyScope)
{ {
fd=0, md=0, cd=0, nd=0, gd=0; fd=0, md=0, cd=0, nd=0, gd=0;
if (memberName.isEmpty()) return FALSE; /* empty name => nothing to link */ if (memberName.isEmpty()) return FALSE; /* empty name => nothing to link */
...@@ -1522,7 +1581,7 @@ bool getDefs(const QCString &scName,const QCString &memberName, ...@@ -1522,7 +1581,7 @@ bool getDefs(const QCString &scName,const QCString &memberName,
//printf("mScope=`%s' mName=`%s'\n",mScope.data(),mName.data()); //printf("mScope=`%s' mName=`%s'\n",mScope.data(),mName.data());
MemberName *mn = memberNameDict[mName]; MemberName *mn = memberNameDict[mName];
if (mn && !(scopeName.isEmpty() && mScope.isEmpty())) if (!forceEmptyScope && mn && !(scopeName.isEmpty() && mScope.isEmpty()))
{ {
//printf(" >member name found\n"); //printf(" >member name found\n");
int scopeOffset=scopeName.length(); int scopeOffset=scopeName.length();
...@@ -1581,7 +1640,7 @@ bool getDefs(const QCString &scName,const QCString &memberName, ...@@ -1581,7 +1640,7 @@ bool getDefs(const QCString &scName,const QCString &memberName,
// no exact match found, but if args="()" an arbitrary member will do // no exact match found, but if args="()" an arbitrary member will do
{ {
//printf(" >Searching for arbitrary member\n"); //printf(" >Searching for arbitrary member\n");
mmd=mn->last(); mmd=mn->first();
while (mmd) while (mmd)
{ {
if (//(mmd->protection()!=Private || Config::extractPrivateFlag) && if (//(mmd->protection()!=Private || Config::extractPrivateFlag) &&
...@@ -1604,7 +1663,7 @@ bool getDefs(const QCString &scName,const QCString &memberName, ...@@ -1604,7 +1663,7 @@ bool getDefs(const QCString &scName,const QCString &memberName,
md=mmd; md=mmd;
} }
} }
mmd=mn->prev(); mmd=mn->next();
} }
} }
//printf(" >Succes=%d\n",mdist<maxInheritanceDepth); //printf(" >Succes=%d\n",mdist<maxInheritanceDepth);
...@@ -1624,164 +1683,160 @@ bool getDefs(const QCString &scName,const QCString &memberName, ...@@ -1624,164 +1683,160 @@ bool getDefs(const QCString &scName,const QCString &memberName,
// unknown or undocumented scope // unknown or undocumented scope
} }
else // maybe an namespace, file or group member ?
// maybe an namespace, file or group member ?
//printf("Testing for global function scopeName=`%s' mScope=`%s' :: mName=`%s'\n",
// scopeName.data(),mScope.data(),mName.data());
//printf(" >member name found\n");
if ((mn=functionNameDict[mName])) // name is known
{ {
//printf("Testing for global function scopeName=`%s' mScope=`%s' :: mName=`%s'\n", NamespaceDef *fnd=0;
// scopeName.data(),mScope.data(),mName.data()); int scopeOffset=scopeName.length();
//printf(" >member name found\n"); do
if ((mn=functionNameDict[mName])) // name is known
{ {
NamespaceDef *fnd=0; QCString namespaceName = scopeName.left(scopeOffset);
int scopeOffset=scopeName.length(); if (!namespaceName.isEmpty() && !mScope.isEmpty())
do
{ {
QCString namespaceName = scopeName.left(scopeOffset); namespaceName+="::"+mScope;
if (!namespaceName.isEmpty() && !mScope.isEmpty()) }
{ else if (!mScope.isEmpty())
namespaceName+="::"+mScope; {
} namespaceName=mScope.copy();
else if (!mScope.isEmpty()) }
if (!namespaceName.isEmpty() &&
(fnd=namespaceDict[namespaceName]) &&
fnd->isLinkable()
)
{
//printf("Function inside existing namespace `%s'\n",namespaceName.data());
bool found=FALSE;
MemberDef *mmd=mn->first();
while (mmd && !found)
{ {
namespaceName=mScope.copy(); //printf("mmd->getNamespaceDef()=%p fnd=%p\n",
// mmd->getNamespaceDef(),fnd);
if (mmd->getNamespaceDef()==fnd &&
//(mmd->isReference() || mmd->hasDocumentation())
mmd->isLinkable()
)
{ // namespace is found
bool match=TRUE;
ArgumentList *argList=0;
if (args)
{
argList=new ArgumentList;
stringToArgumentList(args,argList);
match=matchArguments(mmd->argumentList(),argList,0,namespaceName,FALSE);
}
if (match)
{
nd=fnd;
md=mmd;
found=TRUE;
}
if (args)
{
delete argList; argList=0;
}
}
mmd=mn->next();
} }
if (!namespaceName.isEmpty() && if (!found && !strcmp(args,"()"))
(fnd=namespaceDict[namespaceName]) && // no exact match found, but if args="()" an arbitrary
fnd->isLinkable() // member will do
)
{ {
//printf("Function inside existing namespace `%s'\n",namespaceName.data()); MemberDef *mmd=mn->first();
bool found=FALSE;
MemberDef *mmd=mn->first();
while (mmd && !found) while (mmd && !found)
{ {
//printf("mmd->getNamespaceDef()=%p fnd=%p\n",
// mmd->getNamespaceDef(),fnd);
if (mmd->getNamespaceDef()==fnd && if (mmd->getNamespaceDef()==fnd &&
//(mmd->isReference() || mmd->hasDocumentation()) //(mmd->isReference() || mmd->hasDocumentation())
mmd->isLinkable() mmd->isLinkable()
) )
{ // namespace is found {
nd=fnd;
md=mmd;
found=TRUE;
}
mmd=mn->next();
}
}
if (found) return TRUE;
}
else // no scope => global function
{
//printf("Function with global scope `%s' args=`%s'\n",namespaceName.data(),args);
md=mn->first();
while (md)
{
if (md->isLinkable())
{
fd=md->getFileDef();
gd=md->getGroupDef();
//printf("md->name()=`%s' md->args=`%s' fd=%p gd=%p\n",
// md->name().data(),args,fd,gd);
bool inGroup=FALSE;
if ((fd && fd->isLinkable()) ||
(inGroup=(gd && gd->isLinkable()))
)
{
if (inGroup) fd=0;
//printf("fd=%p gd=%p inGroup=`%d' args=`%s'\n",fd,gd,inGroup,args);
bool match=TRUE; bool match=TRUE;
ArgumentList *argList=0; ArgumentList *argList=0;
if (args) if (args && !md->isDefine())
{ {
argList=new ArgumentList; argList=new ArgumentList;
stringToArgumentList(args,argList); stringToArgumentList(args,argList);
match=matchArguments(mmd->argumentList(),argList,0,namespaceName,FALSE); match=matchArguments(md->argumentList(),argList);
}
if (match)
{
nd=fnd;
md=mmd;
found=TRUE;
}
if (args)
{
delete argList; argList=0; delete argList; argList=0;
} }
} if (match)
mmd=mn->next();
}
if (!found && !strcmp(args,"()"))
// no exact match found, but if args="()" an arbitrary
// member will do
{
MemberDef *mmd=mn->last(); // searching backward will get
// the first defined!
while (mmd && !found)
{
if (mmd->getNamespaceDef()==fnd &&
//(mmd->isReference() || mmd->hasDocumentation())
mmd->isLinkable()
)
{ {
nd=fnd; //printf("Found match!\n");
md=mmd; return TRUE;
found=TRUE;
} }
mmd=mn->prev();
} }
} }
if (found) return TRUE; md=mn->next();
} }
else // no scope => global function if (!strcmp(args,"()"))
{ {
//printf("Function with global scope `%s' args=`%s'\n",namespaceName.data(),args); // no exact match found, but if args="()" an arbitrary
md=mn->first(); // member will do
md=mn->last();
while (md) while (md)
{ {
if (md->isLinkable()) //printf("Found member `%s'\n",md->name().data());
if (1 /* md->isLinkable() */)
{ {
//printf("member is linkable md->name()=`%s'\n",md->name().data());
fd=md->getFileDef(); fd=md->getFileDef();
gd=md->getGroupDef(); gd=md->getGroupDef();
//printf("md->name()=`%s' md->args=`%s' fd=%p gd=%p\n",
// md->name().data(),args,fd,gd);
bool inGroup=FALSE; bool inGroup=FALSE;
if ((fd && fd->isLinkable()) || if ((fd && fd->isLinkable()) ||
(inGroup=(gd && gd->isLinkable())) (inGroup=(gd && gd->isLinkable()))
) )
{ {
if (inGroup) fd=0; if (inGroup) fd=0;
//printf("fd=%p gd=%p inGroup=`%d' args=`%s'\n",fd,gd,inGroup,args); return TRUE;
bool match=TRUE;
ArgumentList *argList=0;
if (args && !md->isDefine())
{
argList=new ArgumentList;
stringToArgumentList(args,argList);
match=matchArguments(md->argumentList(),argList);
delete argList; argList=0;
}
if (match)
{
//printf("Found match!\n");
return TRUE;
}
} }
} }
md=mn->next(); md=mn->prev();
}
if (!strcmp(args,"()"))
{
// no exact match found, but if args="()" an arbitrary
// member will do
md=mn->last();
while (md)
{
//printf("Found member `%s'\n",md->name().data());
if (1 /* md->isLinkable() */)
{
//printf("member is linkable md->name()=`%s'\n",md->name().data());
fd=md->getFileDef();
gd=md->getGroupDef();
bool inGroup=FALSE;
if ((fd && fd->isLinkable()) ||
(inGroup=(gd && gd->isLinkable()))
)
{
if (inGroup) fd=0;
return TRUE;
}
}
md=mn->prev();
}
} }
} }
if (scopeOffset==0) }
{ if (scopeOffset==0)
scopeOffset=-1; {
} scopeOffset=-1;
else if ((scopeOffset=scopeName.findRev("::",scopeOffset-1))==-1) }
{ else if ((scopeOffset=scopeName.findRev("::",scopeOffset-1))==-1)
scopeOffset=0; {
} scopeOffset=0;
} while (scopeOffset>=0); }
} } while (scopeOffset>=0);
else
{
//printf("Unknown function `%s'\n",mName.data());
}
} }
// no nothing found
return FALSE; return FALSE;
} }
...@@ -1878,7 +1933,7 @@ bool generateRef(OutputList &ol,const char *scName, ...@@ -1878,7 +1933,7 @@ bool generateRef(OutputList &ol,const char *scName,
cd->getOutputFileBase(),0,linkText); cd->getOutputFileBase(),0,linkText);
if (!cd->isReference() /*&& !Config::pdfHyperFlag*/) if (!cd->isReference() /*&& !Config::pdfHyperFlag*/)
{ {
writePageRef(ol,cd->name(),0); writePageRef(ol,cd->getOutputFileBase(),0);
} }
} }
else // scope matches that of a namespace else // scope matches that of a namespace
...@@ -1887,7 +1942,7 @@ bool generateRef(OutputList &ol,const char *scName, ...@@ -1887,7 +1942,7 @@ bool generateRef(OutputList &ol,const char *scName,
nd->getOutputFileBase(),0,linkText); nd->getOutputFileBase(),0,linkText);
if (!nd->getReference() /*&& !Config::pdfHyperFlag*/) if (!nd->getReference() /*&& !Config::pdfHyperFlag*/)
{ {
writePageRef(ol,nd->name(),0); writePageRef(ol,nd->getOutputFileBase(),0);
} }
} }
// link has been written, stop now. // link has been written, stop now.
...@@ -1947,10 +2002,11 @@ bool generateRef(OutputList &ol,const char *scName, ...@@ -1947,10 +2002,11 @@ bool generateRef(OutputList &ol,const char *scName,
// scopeStr.data(),nameStr.data(),argsStr.data()); // scopeStr.data(),nameStr.data(),argsStr.data());
// check if nameStr is a member or global. // check if nameStr is a member or global.
if (getDefs(scopeStr,nameStr,argsStr,md,cd,fd,nd,gd)) if (getDefs(scopeStr,nameStr,argsStr,md,cd,fd,nd,gd,scopePos==0))
{ {
//printf("after getDefs nd=%p\n",nd); //printf("after getDefs nd=%p\n",nd);
QCString anchor = md->isLinkable() ? md->anchor() : 0; QCString anchor;
if (md->isLinkable()) anchor = md->anchor();
QCString cName,aName; QCString cName,aName;
if (cd) // nameStr is a member of cd if (cd) // nameStr is a member of cd
{ {
...@@ -1958,7 +2014,7 @@ bool generateRef(OutputList &ol,const char *scName, ...@@ -1958,7 +2014,7 @@ bool generateRef(OutputList &ol,const char *scName,
// cd->getOutputFileBase(),anchor.data(),resultName.stripWhiteSpace().data()); // cd->getOutputFileBase(),anchor.data(),resultName.stripWhiteSpace().data());
ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(), ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),
anchor,linkText.stripWhiteSpace()); anchor,linkText.stripWhiteSpace());
cName=cd->name(); cName=cd->getOutputFileBase();
aName=md->anchor(); aName=md->anchor();
} }
else if (nd) // nameStr is a member of nd else if (nd) // nameStr is a member of nd
...@@ -1966,7 +2022,7 @@ bool generateRef(OutputList &ol,const char *scName, ...@@ -1966,7 +2022,7 @@ bool generateRef(OutputList &ol,const char *scName,
//printf("writing namespace link\n"); //printf("writing namespace link\n");
ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(), ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),
anchor,linkText.stripWhiteSpace()); anchor,linkText.stripWhiteSpace());
cName=nd->name(); cName=nd->getOutputFileBase();
aName=md->anchor(); aName=md->anchor();
} }
else if (fd) // nameStr is a global in file fd else if (fd) // nameStr is a global in file fd
...@@ -1975,7 +2031,7 @@ bool generateRef(OutputList &ol,const char *scName, ...@@ -1975,7 +2031,7 @@ bool generateRef(OutputList &ol,const char *scName,
// resultName.stripWhiteSpace().data()); // resultName.stripWhiteSpace().data());
ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(), ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),
anchor,linkText.stripWhiteSpace()); anchor,linkText.stripWhiteSpace());
cName=fd->name(); cName=fd->getOutputFileBase();
aName=md->anchor(); aName=md->anchor();
} }
else if (gd) else if (gd)
...@@ -1984,7 +2040,7 @@ bool generateRef(OutputList &ol,const char *scName, ...@@ -1984,7 +2040,7 @@ bool generateRef(OutputList &ol,const char *scName,
// gd->name().data()); // gd->name().data());
ol.writeObjectLink(gd->getReference(),gd->getOutputFileBase(), ol.writeObjectLink(gd->getReference(),gd->getOutputFileBase(),
anchor,linkText.stripWhiteSpace()); anchor,linkText.stripWhiteSpace());
cName=gd->name(); cName=gd->getOutputFileBase();
aName=md->anchor(); aName=md->anchor();
} }
else // should not be reached else // should not be reached
...@@ -2003,16 +2059,9 @@ bool generateRef(OutputList &ol,const char *scName, ...@@ -2003,16 +2059,9 @@ bool generateRef(OutputList &ol,const char *scName,
} }
// generate the page reference (for LaTeX) // generate the page reference (for LaTeX)
if (/*!Config::pdfHyperFlag && */(!cName.isEmpty() || !aName.isEmpty())) if (!cName.isEmpty() || !aName.isEmpty())
{ {
if ( writePageRef(ol,cName,aName);
(cd && cd->isLinkableInProject()) ||
(fd && !fd->isReference()) ||
(nd && !nd->isReference())
)
{
writePageRef(ol,cName,aName);
}
} }
return TRUE; return TRUE;
} }
...@@ -2051,9 +2100,6 @@ bool generateLink(OutputList &ol,const char *clName, ...@@ -2051,9 +2100,6 @@ bool generateLink(OutputList &ol,const char *clName,
const char *lr,bool inSeeBlock,const char *lt) const char *lr,bool inSeeBlock,const char *lt)
{ {
QCString linkRef=lr; QCString linkRef=lr;
//PageInfo *pi=0;
//printf("generateLink(%s,%s,%s) inSeeBlock=%d\n",clName,lr,lt,inSeeBlock);
//FileInfo *fi=0;
FileDef *fd; FileDef *fd;
GroupDef *gd; GroupDef *gd;
PageInfo *pi; PageInfo *pi;
...@@ -2066,11 +2112,13 @@ bool generateLink(OutputList &ol,const char *clName, ...@@ -2066,11 +2112,13 @@ bool generateLink(OutputList &ol,const char *clName,
else if ((pi=pageDict[linkRef])) // link to a page else if ((pi=pageDict[linkRef])) // link to a page
{ {
ol.writeObjectLink(0,pi->name,0,lt); ol.writeObjectLink(0,pi->name,0,lt);
writePageRef(ol,pi->name,0);
return TRUE; return TRUE;
} }
else if ((pi=exampleDict[linkRef])) // link to an example else if ((pi=exampleDict[linkRef])) // link to an example
{ {
ol.writeObjectLink(0,convertFileName(pi->name)+"-example",0,lt); ol.writeObjectLink(0,convertFileName(pi->name)+"-example",0,lt);
writePageRef(ol,convertFileName(pi->name)+"-example",0);
return TRUE; return TRUE;
} }
else if ((gd=groupDict[linkRef])) // link to a group else if ((gd=groupDict[linkRef])) // link to a group
...@@ -2081,6 +2129,7 @@ bool generateLink(OutputList &ol,const char *clName, ...@@ -2081,6 +2129,7 @@ bool generateLink(OutputList &ol,const char *clName,
else else
ol.docify(gd->groupTitle()); ol.docify(gd->groupTitle());
ol.endTextLink(); ol.endTextLink();
writePageRef(ol,gd->getOutputFileBase(),0);
return TRUE; return TRUE;
} }
else if ((fd=findFileDef(inputNameDict,linkRef,ambig)) else if ((fd=findFileDef(inputNameDict,linkRef,ambig))
......
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
#include <qtextstream.h> #include <qtextstream.h>
#include <ctype.h> #include <ctype.h>
#include "outputlist.h"
#include "xml.h"
class ClassDef; class ClassDef;
class FileDef; class FileDef;
...@@ -41,6 +39,8 @@ class GroupDef; ...@@ -41,6 +39,8 @@ class GroupDef;
class NamespaceList; class NamespaceList;
class OutputList; class OutputList;
//--------------------------------------------------------------------
class TextGeneratorIntf class TextGeneratorIntf
{ {
public: public:
...@@ -54,22 +54,12 @@ class TextGeneratorIntf ...@@ -54,22 +54,12 @@ class TextGeneratorIntf
class TextGeneratorOLImpl : public TextGeneratorIntf class TextGeneratorOLImpl : public TextGeneratorIntf
{ {
public: public:
TextGeneratorOLImpl(OutputList &ol) : m_ol(ol) {} TextGeneratorOLImpl(OutputList &ol);
void writeString(const char *s) const void writeString(const char *s) const;
{ m_ol.docify(s); } void writeBreak() const;
void writeBreak() const
{
m_ol.pushGeneratorState();
m_ol.disableAllBut(OutputGenerator::Html);
m_ol.lineBreak();
m_ol.popGeneratorState();
}
void writeLink(const char *extRef,const char *file, void writeLink(const char *extRef,const char *file,
const char *anchor,const char *text const char *anchor,const char *text
) const ) const;
{
m_ol.writeObjectLink(extRef,file,anchor,text);
}
private: private:
OutputList &m_ol; OutputList &m_ol;
}; };
...@@ -77,25 +67,18 @@ class TextGeneratorOLImpl : public TextGeneratorIntf ...@@ -77,25 +67,18 @@ class TextGeneratorOLImpl : public TextGeneratorIntf
class TextGeneratorXMLImpl : public TextGeneratorIntf class TextGeneratorXMLImpl : public TextGeneratorIntf
{ {
public: public:
TextGeneratorXMLImpl(QTextStream &t) : m_t(t) {} TextGeneratorXMLImpl(QTextStream &t);
void writeString(const char *s) const void writeString(const char *s) const;
{ void writeBreak() const;
writeXMLString(m_t,s);
}
void writeBreak() const {}
void writeLink(const char *extRef,const char *file, void writeLink(const char *extRef,const char *file,
const char *anchor,const char *text const char *anchor,const char *text
) const ) const;
{
if (extRef==0)
{ writeXMLLink(m_t,file,anchor,text); }
else // external references are not supported for XML
{ writeXMLString(m_t,text); }
}
private: private:
QTextStream &m_t; QTextStream &m_t;
}; };
//--------------------------------------------------------------------
extern void linkifyText(const TextGeneratorIntf &ol,const char *clName,const char *name, extern void linkifyText(const TextGeneratorIntf &ol,const char *clName,const char *name,
const char *text,bool autoBreak=FALSE,bool external=TRUE); const char *text,bool autoBreak=FALSE,bool external=TRUE);
...@@ -105,7 +88,8 @@ extern QCString dateToString(bool); ...@@ -105,7 +88,8 @@ extern QCString dateToString(bool);
extern bool getDefs(const QCString &scopeName,const QCString &memberName, extern bool getDefs(const QCString &scopeName,const QCString &memberName,
const char *, MemberDef *&md, const char *, MemberDef *&md,
ClassDef *&cd,FileDef *&fd, ClassDef *&cd,FileDef *&fd,
NamespaceDef *&nd,GroupDef *&gd NamespaceDef *&nd,GroupDef *&gd,
bool forceEmptyScope=FALSE
); );
extern bool generateRef(OutputList &ol,const char *, extern bool generateRef(OutputList &ol,const char *,
const char *,bool inSeeBlock,const char * =0); const char *,bool inSeeBlock,const char * =0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment