From fb91b752942b81dac21be5ad18bcb09fbafa711b Mon Sep 17 00:00:00 2001 From: dimitri Date: Sun, 9 Mar 2008 18:07:08 +0000 Subject: Release-1.5.5-20080309 --- INSTALL | 4 +- README | 4 +- configure | 2 +- doc/config.doc | 16 +++ src/config.l | 14 +++ src/filedef.cpp | 7 ++ src/filedef.h | 5 +- src/fortrancode.l | 9 +- src/fortranscanner.l | 347 +++++++++++++++++++++++++++++++++++++++++---------- src/index.cpp | 3 +- src/namespacedef.cpp | 13 +- 11 files changed, 341 insertions(+), 83 deletions(-) diff --git a/INSTALL b/INSTALL index 93fe994..90371bd 100644 --- a/INSTALL +++ b/INSTALL @@ -1,7 +1,7 @@ -DOXYGEN Version 1.5.5-20080307 +DOXYGEN Version 1.5.5-20080309 Please read the installation section of the manual (http://www.doxygen.org/install.html) for instructions. -------- -Dimitri van Heesch (07 March 2008) +Dimitri van Heesch (09 March 2008) diff --git a/README b/README index b5c35ec..bf356fe 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -DOXYGEN Version 1.5.5_20080307 +DOXYGEN Version 1.5.5_20080309 Please read INSTALL for compilation instructions. @@ -17,4 +17,4 @@ to subscribe to the lists or to visit the archives. Enjoy, -Dimitri van Heesch (dimitri@stack.nl) (07 March 2008) +Dimitri van Heesch (dimitri@stack.nl) (09 March 2008) diff --git a/configure b/configure index b8d08a9..751e270 100755 --- a/configure +++ b/configure @@ -20,7 +20,7 @@ doxygen_version_minor=5 doxygen_version_revision=5 #NOTE: Setting version_mmn to "NO" will omit mmn info from the package. -doxygen_version_mmn=20080307 +doxygen_version_mmn=20080309 bin_dirs=`echo $PATH | sed -e "s/:/ /g"` diff --git a/doc/config.doc b/doc/config.doc index 73ee99c..e9042e5 100644 --- a/doc/config.doc +++ b/doc/config.doc @@ -203,7 +203,9 @@ followed by the descriptions of the tags grouped by category. \refitem cfg_separate_member_pages SEPARATE_MEMBER_PAGES \refitem cfg_short_names SHORT_NAMES \refitem cfg_show_dirs SHOW_DIRECTORIES +\refitem cfg_show_files SHOW_FILES \refitem cfg_show_include_files SHOW_INCLUDE_FILES +\refitem cfg_show_namespaces SHOW_NAMESPACES \refitem cfg_show_used_files SHOW_USED_FILES \refitem cfg_sip_support SIP_SUPPORT \refitem cfg_skip_function_macros SKIP_FUNCTION_MACROS @@ -766,6 +768,20 @@ function's detailed documentation block. then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy in the documentation. +\anchor cfg_show_files +
\c SHOW_FILES
+ \addindex SHOW_FILES + Set the \c SHOW_FILES tag to \c NO to disable the generation of the Files page. + This will remove the Files entry from the Quick Index and from the + Folder Tree View (if specified). The default is \c YES. + +\anchor cfg_show_namespaces +
\c SHOW_NAMESPACES
+ \addindex SHOW_NAMESPACES + Set the \c SHOW_NAMESPACES tag to \c NO to disable the generation of the + Namespaces page. This will remove the Namespaces entry from the Quick Index + and from the Folder Tree View (if specified). The default is \c YES. + \section messages_input Options related to warning and progress messages diff --git a/src/config.l b/src/config.l index b317828..7d61563 100644 --- a/src/config.l +++ b/src/config.l @@ -1972,6 +1972,20 @@ void Config::create() "in the documentation. The default is NO.\n", FALSE ); + cb = addBool( + "SHOW_FILES", + "Set the SHOW_FILES tag to NO to disable the generation of the Files page.\n" + "This will remove the Files entry from the Quick Index and from the \n" + "Folder Tree View (if specified). The default is YES.\n", + TRUE + ); + cb = addBool( + "SHOW_NAMESPACES", + "Set the SHOW_NAMESPACES tag to NO to disable the generation of the \n" + "Namespaces page. This will remove the Namespaces entry from the Quick Index\n" + "and from the Folder Tree View (if specified). The default is YES.\n", + TRUE + ); cs = addString( "FILE_VERSION_FILTER", "The FILE_VERSION_FILTER tag can be used to specify a program or script that \n" "doxygen should invoke to get the current version for each file (typically from \n" diff --git a/src/filedef.cpp b/src/filedef.cpp index 47304c2..5ba3094 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -1449,3 +1449,10 @@ void FileDef::writeMemberDocumentation(OutputList &ol,MemberList::ListType lt,co MemberList * ml = getMemberList(lt); if (ml) ml->writeDocumentation(ol,name(),this,title); } + +bool FileDef::isLinkableInProject() const +{ + static bool showFiles = Config_getBool("SHOW_FILES"); + return hasDocumentation() && !isReference() && showFiles; +} + diff --git a/src/filedef.h b/src/filedef.h index d03f816..6ea8d23 100644 --- a/src/filedef.h +++ b/src/filedef.h @@ -116,10 +116,7 @@ class FileDef : public Definition /*! Returns version of this file. */ QCString getVersion() const { return fileVersion; } - bool isLinkableInProject() const - { - return hasDocumentation() && !isReference(); - } + bool isLinkableInProject() const; bool isLinkable() const { diff --git a/src/fortrancode.l b/src/fortrancode.l index 5ca162e..85699de 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -542,7 +542,7 @@ void endUseScope() currentUseNames= useStack.pop(); if (currentUseNames == 0) { - fprintf(stderr,"fortrancode.l: stack empty!"); + fprintf(stderr,"WARNING: fortrancode.l: stack empty!"); //exit(-1); } } @@ -691,7 +691,7 @@ IGNORE (IMPLICIT{BS}NONE|CONTAINS|WRITE|READ|ALLOCATE|DEALLOCATE|SIZE) currentModule=0; REJECT; } -"end"({BS_}("program"|"module"|"type"|"interface"))? { // +^{BS}"end"({BS}("program"|"module"|"type"|"interface")({BS_}{ID})?)?{BS}/(\n|!) { // endUseScope(); startFontClass("keyword"); codifyLines(yytext); @@ -722,7 +722,7 @@ IGNORE (IMPLICIT{BS}NONE|CONTAINS|WRITE|READ|ALLOCATE|DEALLOCATE|SIZE) "\n" { codifyLines(yytext); yy_pop_state(); } -"end"({BS_}{SUBPROG})? { // Fortran subroutine or function ends +"^{BS}end"({BS}{SUBPROG}({BS_}{ID})?)?{BS}/(\n|!) { // Fortran subroutine or function ends //cout << "===> end function " << yytext << endl; endUseScope(); startFontClass("keyword"); @@ -860,6 +860,8 @@ IGNORE (IMPLICIT{BS}NONE|CONTAINS|WRITE|READ|ALLOCATE|DEALLOCATE|SIZE) endFontClass(); yy_pop_state(); } +. {str+=yytext;} + <*>\"|\' { /* string starts */ /* if(YY_START == StrIgnore) REJECT; // ignore in simple comments */ yy_push_state(YY_START); @@ -867,7 +869,6 @@ IGNORE (IMPLICIT{BS}NONE|CONTAINS|WRITE|READ|ALLOCATE|DEALLOCATE|SIZE) BEGIN(String); str=yytext; } -. {str+=yytext;} /*-----------------------------------------------------------------------------*/ <*>\n { diff --git a/src/fortranscanner.l b/src/fortranscanner.l index 12104c0..5722236 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -112,6 +112,14 @@ static const char *directionStrs[] = static ParserInterface *g_thisParser; static const char * inputString; static int inputPosition; +static QCString inputStringPrepass; ///< Input string for prepass of line cont. '&' +static unsigned int inputPositionPrepass; +static int lineCountPrepass = 0; + +#define MAX_INCLUDE_DEPTH 10 +YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; +int include_stack_ptr = 0; + static QFile inputFile; static QCString yyFileName; static int yyLineNr = 1 ; @@ -138,6 +146,7 @@ static Argument *parameter; // element of parameter list static QCString argType; // fortran type of an argument of a parameter list static QCString argName; // last identifier name in variable list static QCString initializer; // initial value of a variable +static int initializerScope; // number if nested array scopes in initializer static QCString useModuleName; // name of module in the use statement static Protection defaultProtection; @@ -154,15 +163,20 @@ static int yyread(char *buf,int max_size); static void startCommentBlock(bool); static void handleCommentBlock(const QCString &doc,bool brief); static void addCurrentEntry(); +static void addModule(const char *name); +static void addSubprogram(const char *text); static void addInterface(QCString name); static Argument *addFortranParameter(const QCString &type,const QCString &name, const QCString docs); static void scanner_abort(); static void startScope(Entry *scope); -static bool endScope(Entry *scope); +static bool endScope(Entry *scope, bool isGlobalRoot=FALSE); static QCString getFullName(Entry *e); static bool isTypeName(QCString name); static void resolveModuleProcedures(QList &moduleProcedures, Entry *current_root); +static int getAmpersandAtTheEnd(const char *buf, int length); +static void pushBuffer(QCString &buffer); +static void popBuffer(); //----------------------------------------------------------------------------- #undef YY_INPUT @@ -198,6 +212,9 @@ ACCESS_SPEC (PRIVATE|PUBLIC) /* Assume that attribute statements are almost the same as attributes. */ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} +CONTAINS CONTAINS +PREFIX (RECURSIVE{BS_}|PURE{BS_}|ELEMENTAL{BS_}){0,2}(RECURSIVE|PURE|ELEMENTAL)? + %option noyywrap %option stack %option caseless @@ -207,12 +224,15 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} /** fortran parsing states */ %x Subprog +%x SubprogPrefix %x Parameterlist %x SubprogBody +%x SubprogBodyContains %x Start %x Comment %x Module %x ModuleBody +%x ModuleBodyContains %x AttributeList %x Variable %x Initialization @@ -226,6 +246,8 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} %x UseOnly %x ModuleProcedure +%x Prepass + /** comment parsing states */ %x DocBlock %x DocBackLine @@ -235,9 +257,36 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} /*-----------------------------------------------------------------------------------*/ -<*>"&".*"\n" { if (YY_START == String) REJECT; // "&" is ignored in strings - yyLineNr++;} /* line not finished -> read next line (text after "&" may be - comment and has to be ignored */ +<*>^.*"&"{BS}(!.*)?\n { // ampersand is somewhere in line + //fprintf(stderr, "---%s", yytext); + + int index = getAmpersandAtTheEnd(yytext, yyleng); + if(index<0){ // ampersand is not line continuation + if(YY_START == Prepass) { // last line in "continuation" + inputStringPrepass+=(const char*)yytext; + pushBuffer(inputStringPrepass); + yy_pop_state(); + } else { // simple line + REJECT; + } + } else { // line with continuation + inputStringPrepass+=(const char*)yytext; + lineCountPrepass ++; + + // replace & with space and remove the following chars + int length = inputStringPrepass.length(); + inputStringPrepass[length-yyleng+index] = ' '; + inputStringPrepass.truncate(length-yyleng+index+1); + if(YY_START != Prepass) + yy_push_state(Prepass); + } + } + +^.*\n { + inputStringPrepass+=(const char*)yytext; + pushBuffer(inputStringPrepass); + yy_pop_state(); + } /*------ ignore strings */ <*>"\\\\" { /* ignore \\ */} @@ -280,9 +329,13 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} /*------ use handling ------------------------------------------------------------*/ -"use"{BS_} { - yy_push_state(YY_START); - BEGIN(Use); +"use"{BS_} { + if(YY_START == Start) + { + addModule(NULL); + yy_push_state(ModuleBody); //anon program + } + yy_push_state(Use); } {ID} { //fprintf(stderr,"using dir %s\n",yytext); @@ -313,6 +366,12 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} /*------ ignore special fortran statements */ ^[ \t]*interface({BS_}{ID}({BS}\({BS}[^ \t()]+{BS}\))?)? { // handle interface block + if(YY_START == Start) + { + addModule(NULL); + yy_push_state(ModuleBody); //anon program + } + QCString name = yytext; int index = name.find("interface", 0, FALSE); index = name.find(QRegExp("[^ \\t]"), index+9); @@ -325,7 +384,7 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} yy_push_state(InterfaceBody); startScope(last_entry); } -^{BS}"end"({BS_}"interface")? { +^{BS}"end"({BS}"interface"({BS_}{ID})?)?{BS}/(\n|!) { if (!endScope(current_root)) yyterminate(); yy_pop_state(); @@ -343,31 +402,32 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} yy_pop_state(); } . {} - + + /*-- Contains handling --*/ +^{BS}{CONTAINS}/({BS}|\n|!) { + if(YY_START == Start) + { + addModule(NULL); + yy_push_state(ModuleBodyContains); //anon program + } + } +^{BS}{CONTAINS}/({BS}|\n|!) { BEGIN(ModuleBodyContains); } +^{BS}{CONTAINS}/({BS}|\n|!) { BEGIN(SubprogBodyContains); } + /*------ module handling ------------------------------------------------------------*/ module|program{BS_} { // - BEGIN(Module); + yy_push_state(Module); defaultProtection = Public; } -^{BS}"end"({BS_}(module|program))?{BS} { // end module +^{BS}"end"({BS}(module|program)({BS_}{ID})?)?{BS}/(\n|!) { // end module resolveModuleProcedures(moduleProcedures, current_root); if (!endScope(current_root)) yyterminate(); defaultProtection = Public; - BEGIN(Start); + yy_pop_state(); } {ID} { - //cout << "0=========> got module " << yytext << endl; - current->section = Entry::NAMESPACE_SEC; - current->name = yytext; - current->type = "module"; - current->fileName = yyFileName; - current->bodyLine = yyLineNr; // used for source reference - current->protection = Public ; - - addCurrentEntry(); - startScope(last_entry); - + addModule(yytext); BEGIN(ModuleBody); } @@ -379,8 +439,13 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} /*------- type definition -------------------------------------------------------------------------------*/ "type"({BS_}|({COMMA}{ACCESS_SPEC})) { /* type definition found : TYPE , access-spec::type-name |*/ - yy_push_state(YY_START); - BEGIN(Typedef); + if(YY_START == Start) + { + addModule(NULL); + yy_push_state(ModuleBody); //anon program + } + + yy_push_state(Typedef); current->protection = defaultProtection; } {ACCESS_SPEC} { @@ -406,7 +471,7 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} startScope(last_entry); BEGIN(TypedefBody); } -"end"{BS_}"type".* { /* end type definition */ +^{BS}"end"{BS}"type"({BS_}{ID})?{BS}/(\n|!) { /* end type definition */ //cout << "=========> got typedef end "<< endl; if (!endScope(current_root)) yyterminate(); @@ -415,8 +480,8 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} /*------- module/global/typedef variable ---------------------------------------------------*/ -^{BS}"end"({BS_}{SUBPROG})?{BS} { - //cout << "1e=========> got end subprog: " << yytext << endl; +^{BS}"end"({BS}{SUBPROG}({BS_}{ID})?)?{BS}/(\n|!) { + //fprintf(stderr,"1e=========> got end subprog: %s\n", yytext); /* args is used for parameters in list of functions, argList for parameters in detailed function descripttion */ @@ -427,8 +492,13 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} yy_pop_state() ; } { -{TYPE_SPEC}/{SEPARATE} { +^{BS}{TYPE_SPEC}/{SEPARATE} { /* variable declaration starts */ + if(YY_START == Start) + { + addModule(NULL); + yy_push_state(ModuleBody); //anon program + } //fprintf(stderr,"4=========> got variable type: %s\n",yytext); QCString help=yytext; help= help.simplifyWhiteSpace(); @@ -530,19 +600,26 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} {COMMA} {} {BS}"=" { yy_push_state(YY_START); initializer=""; + initializerScope = 0; BEGIN(Initialization); } "\n" { currentModifiers = SymbolModifiers(); yy_pop_state(); // end variable deklaration list - yyLineNr++; + yyLineNr++; yyLineNr+=lineCountPrepass; lineCountPrepass=0; docBlock.resize(0); } -"(" { initializer+=yytext; - BEGIN(ArrayInitializer); // initializer may contain comma +"(/" { initializer+=yytext; + initializerScope++; + BEGIN(ArrayInitializer); // initializer may contain comma } -")" { initializer+=yytext; - BEGIN(Initialization); +"/)" { initializer+=yytext; + initializerScope--; + if(initializerScope<=0) + { + initializerScope = 0; // just in case + BEGIN(Initialization); + } } . { initializer+=yytext; } {COMMA} { yy_pop_state(); // end initialization @@ -558,25 +635,44 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} /*------ fortran subroutine/function handling ------------------------------------------------------------*/ /* Start is initial condition */ -{TYPE_SPEC}{BS}/{SUBPROG}{BS_} { +^{BS}({PREFIX}{BS_})?{TYPE_SPEC}{BS}/{SUBPROG}{BS_} { // TYPE_SPEC is for old function style function result - result= yytext; + result= yytext; result= result.stripWhiteSpace(); + int prefixIndex = 0; + int curIndex = 0; + bool cont = TRUE; + const char* pre[] = {"RECURSIVE","PURE","ELEMENTAL"}; + while(cont) + { + cont = FALSE; + for(unsigned int i=0; i<3; i++) + { + if((prefixIndex=result.find(pre[i], curIndex, FALSE))==0) + { + result.remove(0,strlen(pre[i])); + result.stripWhiteSpace(); + cont = TRUE; + } + } + } + //fprintf(stderr, "===%s\n", (const char*)result); current->type = result; - } -{BS}{SUBPROG}{BS_} { // Fortran subroutine or function found - //fprintf(stderr,"1=========> got subprog, type: %s\n",yytext); - current->section = Entry::FUNCTION_SEC ; - QCString subtype = yytext; subtype=subtype.lower().stripWhiteSpace(); - if (!current->type) current->type = subtype; - current->fileName = yyFileName; - current->bodyLine = yyLineNr; // used for source reference - current->startLine = -1; // ??? what is startLine for? - current->args.resize(0); - current->argList->clear(); - yy_push_state(Subprog); - docBlock.resize(0); + yy_push_state(SubprogPrefix); + } + +{BS}{SUBPROG}{BS_} { + // Fortran subroutine or function found + addSubprogram(yytext); + BEGIN(Subprog); + } + +^{BS}{SUBPROG}{BS_} { + // Fortran subroutine or function found + addSubprogram(yytext); + yy_push_state(Subprog); } + {BS} { /* ignore white space */ } {ID} { current->name = yytext; //cout << "1a==========> got " << current->type << " " << yytext << " " << yyLineNr << endl; @@ -587,9 +683,9 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} //current->type not yet available QCString arglist= yytext; //cout << "3=========> got parameterlist " << yytext << endl; - yyLineNr+= arglist.contains('\n'); - static QRegExp re("&[^\n]*\n"); - arglist = arglist.replace(re,""); + //yyLineNr+= arglist.contains('\n'); + //static QRegExp re("&[^\n]*\n"); + //arglist = arglist.replace(re,""); //cout << "3=========> got parameterlist " << arglist << endl; current->args = arglist; current->args = removeRedundantWhiteSpace(current->args); @@ -599,8 +695,8 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} BEGIN(SubprogBody); } {NOARGS} { - yyLineNr++; - //cout << "3=========> without parameterlist " < without parameterlist \n"); stringToArgumentList("", current->argList); addCurrentEntry(); startScope(last_entry); @@ -643,7 +739,7 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} yy_pop_state(); } -"!>" { +"!>" { yy_push_state(YY_START); current->docLine = yyLineNr; docBlockJavaStyle = FALSE; @@ -659,7 +755,7 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} } "\n"{BS}"!"(">"|"!"+) { // comment block (next line is also comment line) docBlock+="\n"; // \n is necessary for lists - yyLineNr++; + yyLineNr++; yyLineNr+=lineCountPrepass; lineCountPrepass=0; } "\n" { // comment block ends at the end of this line //cout <<"3=========> comment block : "<< docBlock << endl; @@ -671,19 +767,27 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} /*------------------------------------------------------------------------------------------------*/ <*>"\n" { - yyLineNr++; + yyLineNr++; yyLineNr+=lineCountPrepass; lineCountPrepass=0; //if (debugStr.stripWhiteSpace().length() > 0) cout << "ignored text: " << debugStr << " state: " <<> { - fprintf(stderr,"==== Error: EOF reached in wrong state (end missing)"); - scanner_abort(); - yyterminate(); + +<*><> { + if ( include_stack_ptr <= 0 ) { + if (YY_START!=INITIAL && YY_START!=Start) { + //fprintf(stderr,"==== Error: EOF reached in wrong state (end missing)"); + scanner_abort(); + } + yyterminate(); + } else { + popBuffer(); + } } <*>. { - debugStr+=yytext; + //debugStr+=yytext; } // ignore remaining text /**********************************************************************************/ @@ -692,6 +796,70 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} %% //---------------------------------------------------------------------------- +static int getAmpersandAtTheEnd(const char *buf, int length) +{ + // Avoid ampersands in string and comments + int parseState = Start; + char quoteSymbol = 0; + int ampIndex = -1; + + for(int i=0; i= MAX_INCLUDE_DEPTH ) + { + fprintf( stderr, "Stack buffers nested too deeply" ); + exit( 1 ); + } + include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER; + yy_switch_to_buffer(yy_scan_string(buffer)); + + //fprintf(stderr, "--POP--%s", (const char *)buffer); + buffer = NULL; +} + +static void popBuffer() { + include_stack_ptr --; + yy_delete_buffer( YY_CURRENT_BUFFER ); + yy_switch_to_buffer( include_stack[include_stack_ptr] ); +} + /** used to copy entry to an interface module procedure */ static void copyEntry(Entry *dest, Entry *src) { @@ -973,10 +1141,10 @@ static void startScope(Entry *scope) /*! Ends scope in fortran program: may update subprogram arguments or module variable attributes. * \see startScope() */ -static bool endScope(Entry *scope) +static bool endScope(Entry *scope, bool isGlobalRoot) { //cout<<"end scope: "<name<parent()) + if (current_root->parent() || isGlobalRoot) { current_root= current_root->parent(); /* end substructure */ } @@ -1072,6 +1240,7 @@ static QCString getFullName(Entry *e) static int yyread(char *buf,int max_size) { int c=0; + while ( c < max_size && inputString[inputPosition] ) { *buf = inputString[inputPosition++] ; @@ -1099,13 +1268,55 @@ static void initEntry() */ static void addCurrentEntry() { - //cout << "Adding entry " <name.data() << endl; + //printf("===Adding entry %s to %s\n", current->name.data(), current_root->name.data()); current_root->addSubEntry(current); last_entry = current; current = new Entry ; initEntry(); } +static int max(int a, int b) {return a>b?a:b;} + +static void addModule(const char *name) +{ + //fprintf(stderr, "0=========> got module %s\n", name); + + current->section = Entry::NAMESPACE_SEC; + if (name!=NULL) + { + current->name = name; + } + else + { + QCString fname = yyFileName; + int index = max(fname.findRev('/'), fname.findRev('\\')); + fname = fname.right(fname.length()-index-1); + fname = fname.prepend("__").append("__"); + current->name = fname; + } + current->type = "program"; + current->fileName = yyFileName; + current->bodyLine = yyLineNr; // used for source reference + current->protection = Public ; + addCurrentEntry(); + startScope(last_entry); +} + + +static void addSubprogram(const char *text) +{ + //fprintf(stderr,"1=========> got subprog, type: %s\n",text); + current->section = Entry::FUNCTION_SEC ; + QCString subtype = text; subtype=subtype.lower().stripWhiteSpace(); + if (!current->type) current->type = subtype; + current->fileName = yyFileName; + current->bodyLine = yyLineNr; // used for source reference + current->startLine = -1; // ??? what is startLine for? + current->args.resize(0); + current->argList->clear(); + docBlock.resize(0); +} + /*! Adds interface to the root entry. * \note Code was brought to this procedure from the parser, * because there was/is idea to use it in several parts of the parser. @@ -1231,6 +1442,8 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt) defaultProtection = Public; inputString = fileBuf; inputPosition = 0; + inputStringPrepass = NULL; + inputPositionPrepass = 0; //anonCount = 0; // don't reset per file mtype = Method; @@ -1245,7 +1458,7 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt) yyFileName = fileName; msg("Parsing file %s...\n",yyFileName.data()); - current_root = rt ; + startScope(rt); // implies current_root = rt initParser(); groupEnterFile(yyFileName,yyLineNr); @@ -1264,6 +1477,8 @@ static void parseMain(const char *fileName,const char *fileBuf,Entry *rt) fscanYYlex(); groupLeaveFile(yyFileName,yyLineNr); + endScope(current_root, TRUE); // TRUE - global root + //debugCompounds(rt); //debug rt->program.resize(0); diff --git a/src/index.cpp b/src/index.cpp index 031f01f..711e760 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -3008,7 +3008,8 @@ void writeIndex(OutputList &ol) { ol.startIndexSection(isCompoundIndex); ol.parseText(/*projPrefix+*/ - (vhdlOpt ? VhdlDocGen::trDesignUnitIndex() : + (fortranOpt ? theTranslator->trCompoundIndexFortran() : + vhdlOpt ? VhdlDocGen::trDesignUnitIndex() : theTranslator->trCompoundIndex() )); ol.endIndexSection(isCompoundIndex); diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 2df94db..09dab2d 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -769,12 +769,19 @@ bool NamespaceDef::isLinkableInProject() const int i = name().findRev("::"); if (i==-1) i=0; else i+=2; static bool extractAnonNs = Config_getBool("EXTRACT_ANON_NSPACES"); - if (extractAnonNs && name().mid(i,20)=="anonymous_namespace{") + static bool showNamespaces = Config_getBool("SHOW_NAMESPACES"); + if (extractAnonNs && // extract anonymous ns + name().mid(i,20)=="anonymous_namespace{" && // correct prefix + showNamespaces) // not disabled by config { return TRUE; } - return !name().isEmpty() && name().at(i)!='@' && - hasDocumentation() && !isReference() && !isHidden() && !isArtificial(); + return !name().isEmpty() && name().at(i)!='@' && // not anonymous + hasDocumentation() && // documented + !isReference() && // not an external reference + !isHidden() && // not hidden + !isArtificial() && // or artificial + showNamespaces; // not disabled by config } bool NamespaceDef::isLinkable() const -- cgit v0.12