diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commentcnv.l | 39 | ||||
-rw-r--r-- | src/commentscan.l | 8 | ||||
-rw-r--r-- | src/config.l | 12 | ||||
-rw-r--r-- | src/defargs.l | 7 | ||||
-rw-r--r-- | src/definition.cpp | 39 | ||||
-rw-r--r-- | src/docsets.cpp | 11 | ||||
-rw-r--r-- | src/doxygen.cpp | 6 | ||||
-rw-r--r-- | src/filedef.cpp | 5 | ||||
-rw-r--r-- | src/fortrancode.l | 12 | ||||
-rw-r--r-- | src/fortranscanner.l | 156 | ||||
-rw-r--r-- | src/groupdef.cpp | 40 | ||||
-rw-r--r-- | src/groupdef.h | 4 | ||||
-rw-r--r-- | src/index.cpp | 2 | ||||
-rw-r--r-- | src/pre.l | 12 | ||||
-rw-r--r-- | src/pyscanner.l | 2 | ||||
-rw-r--r-- | src/scanner.l | 3 | ||||
-rw-r--r-- | src/util.cpp | 23 | ||||
-rw-r--r-- | src/vhdldocgen.cpp | 67 | ||||
-rw-r--r-- | src/vhdlscanner.l | 1 |
19 files changed, 292 insertions, 157 deletions
diff --git a/src/commentcnv.l b/src/commentcnv.l index 68ee64e..b772868 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -64,6 +64,7 @@ static bool g_inSpecialComment; static QCString g_aliasString; static int g_blockCount; static int g_lastBlockContext; +static bool g_PythonDocString; static SrcLangExt g_lang; @@ -273,6 +274,18 @@ void replaceComment(int offset); <Scan>[^"'\/\n\\#\\-]* { /* eat anything that is not " / or \n */ copyToOutput(yytext,yyleng); } +<Scan>"\"\"\""! { /* start of python long comment */ + if (g_lang!=SrcLangExt_Python) + { + REJECT; + } + else + { + g_PythonDocString = TRUE; + copyToOutput(yytext,yyleng); + BEGIN(CComment); + } + } <Scan>"\"" { /* start of a string */ copyToOutput(yytext,yyleng); BEGIN(SkipString); @@ -431,15 +444,34 @@ void replaceComment(int offset); <CComment>"*"+[^*/\\@\n]* { /* stars without slashes */ copyToOutput(yytext,yyleng); } +<CComment>"\"\"\"" { /* end of Python docstring */ + if (g_lang!=SrcLangExt_Python) + { + REJECT; + } + else + { + g_PythonDocString = FALSE; + copyToOutput(yytext,yyleng); + BEGIN(Scan); + } + } <CComment>\n { /* new line in comment */ copyToOutput(yytext,yyleng); } <CComment>"*"+"/" { /* end of C comment */ - copyToOutput(yytext,yyleng); - BEGIN(Scan); + if (g_lang==SrcLangExt_Python) + { + REJECT; + } + else + { + copyToOutput(yytext,yyleng); + BEGIN(Scan); + } } <CComment>"\n"/[ \t]*[^#] { /* end of Python comment */ - if (g_lang!=SrcLangExt_Python) + if (g_lang!=SrcLangExt_Python || g_PythonDocString) { REJECT; } @@ -646,6 +678,7 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) g_skip = FALSE; g_fileName = fileName; g_lang = getLanguageFromFileName(fileName); + g_PythonDocString = FALSE; g_lineNr = 0; g_condStack.clear(); g_condStack.setAutoDelete(TRUE); diff --git a/src/commentscan.l b/src/commentscan.l index b72df2f..115aac4 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -57,6 +57,7 @@ static bool handleWeakGroup(const QCString &); static bool handleNamespace(const QCString &); static bool handlePackage(const QCString &); static bool handleClass(const QCString &); +static bool handleHeaderFile(const QCString &); static bool handleProtocol(const QCString &); static bool handleCategory(const QCString &); static bool handleUnion(const QCString &); @@ -134,6 +135,7 @@ static DocCmdMap docCmdMap[] = { "namespace", &handleNamespace, TRUE }, { "package", &handlePackage, TRUE }, { "class", &handleClass, TRUE }, + { "headerfile", &handleHeaderFile, TRUE }, { "protocol", &handleProtocol, TRUE }, { "category", &handleCategory, TRUE }, { "union", &handleUnion, TRUE }, @@ -1900,6 +1902,12 @@ static bool handleClass(const QCString &) return stop; } +static bool handleHeaderFile(const QCString &) +{ + BEGIN( ClassDocArg2 ); + return FALSE; +} + static bool handleProtocol(const QCString &) { // Obj-C protocol bool stop=makeStructuralIndicator(Entry::PROTOCOLDOC_SEC); diff --git a/src/config.l b/src/config.l index 4be1ff7..b328d50 100644 --- a/src/config.l +++ b/src/config.l @@ -1214,6 +1214,7 @@ void Config::check() filePatternList.append("*.dox"); filePatternList.append("*.py"); filePatternList.append("*.f90"); + filePatternList.append("*.f"); filePatternList.append("*.vhd"); filePatternList.append("*.vhdl"); if (portable_fileSystemIsCaseSensitive()) @@ -1234,6 +1235,7 @@ void Config::check() filePatternList.append("*.MM"); filePatternList.append("*.PY"); filePatternList.append("*.F90"); + filePatternList.append("*.F"); filePatternList.append("*.VHD"); filePatternList.append("*.VHDL"); } @@ -1747,13 +1749,13 @@ void Config::create() TRUE ); cb = addBool( "TYPEDEF_HIDES_STRUCT", - "When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct (or union) is \n" - "documented as struct with the name of the typedef. So \n" + "When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum \n" + "is documented as struct, union, or enum with the name of the typedef. So \n" "typedef struct TypeS {} TypeT, will appear in the documentation as a struct \n" "with name TypeT. When disabled the typedef will appear as a member of a file, \n" "namespace, or class. And the struct will be named TypeS. This can typically \n" - "be useful for C code where the coding convention is that all structs are \n" - "typedef'ed and only the typedef is referenced never the struct's name.\n", + "be useful for C code in case the coding convention dictates that all compound \n" + "types are typedef'ed and only the typedef is referenced, never the tag name.\n", FALSE ); //----------------------------------------------------------------------------------------------- @@ -2305,7 +2307,7 @@ void Config::create() "GENERATE_HTMLHELP", "If the GENERATE_HTMLHELP tag is set to YES, additional index files \n" "will be generated that can be used as input for tools like the \n" - "Microsoft HTML help workshop to generate a compressed HTML help file (.chm) \n" + "Microsoft HTML help workshop to generate a compiled HTML help file (.chm) \n" "of the generated HTML documentation. \n", FALSE ); diff --git a/src/defargs.l b/src/defargs.l index b7259a1..ea37c45 100644 --- a/src/defargs.l +++ b/src/defargs.l @@ -149,7 +149,7 @@ ID [a-z_A-Z][a-z_A-Z0-9]* <ReadFuncArgPtr>{ID} { g_curArgName=yytext; } -<ReadFuncArgPtr>")"{B}*"(" { +<ReadFuncArgPtr>")"{B}*"(" { // function pointer g_curArgTypeName+=yytext; //g_curArgTypeName=g_curArgTypeName.simplifyWhiteSpace(); g_readArgContext = ReadFuncArgType; @@ -157,6 +157,11 @@ ID [a-z_A-Z][a-z_A-Z0-9]* g_argRoundCount=0; BEGIN( CopyArgRound2 ); } +<ReadFuncArgPtr>")"/{B}*"[" { // pointer to fixed size array + g_curArgTypeName+=yytext; + //g_curArgTypeName=g_curArgTypeName.simplifyWhiteSpace(); + BEGIN( ReadFuncArgType ); + } <ReadFuncArgPtr>")" { // redundant braces detected / remove them int i=g_curArgTypeName.findRev('('),l=g_curArgTypeName.length(); if (i!=-1) diff --git a/src/definition.cpp b/src/definition.cpp index 9bc0ad6..3d742ef 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -36,15 +36,12 @@ #include "htags.h" #include "parserintf.h" #include "marshal.h" - -#if defined(_MSC_VER) || defined(__BORLANDC__) -#define popen _popen -#define pclose _pclose -#endif +#include "debug.h" #define START_MARKER 0x4445465B // DEF[ #define END_MARKER 0x4445465D // DEF] +//----------------------------------------------------------------------------------------- class DefinitionImpl { @@ -476,20 +473,33 @@ void Definition::setBriefDescription(const char *b,const char *briefFile,int bri * stored in \a result. If FALSE is returned the code fragment could not be * found. * - * The file is scanned for a opening bracket ('{') from \a startLine onward. + * The file is scanned for a opening bracket ('{') from \a startLine onward * The line actually containing the bracket is returned via startLine. * The file is scanned for a closing bracket ('}') from \a endLine backward. * The line actually containing the bracket is returned via endLine. + * Note that for VHDL code the bracket search is not done. */ static bool readCodeFragment(const char *fileName, int &startLine,int &endLine,QCString &result) { - static bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL"); + static bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL"); + static bool filterSourceFiles = Config_getBool("FILTER_SOURCE_FILES"); //printf("readCodeFragment(%s,%d,%d)\n",fileName,startLine,endLine); if (fileName==0 || fileName[0]==0) return FALSE; // not a valid file name - QCString cmd=getFileFilter(fileName)+" \""+fileName+"\""; - FILE *f = Config_getBool("FILTER_SOURCE_FILES") ? popen(cmd,"r") : fopen(fileName,"r"); - bool found=vhdlOpt; // for VHDL not bracket search is possible + QCString filter = getFileFilter(fileName); + FILE *f=0; + bool usePipe = !filter.isEmpty() && filterSourceFiles; + if (!usePipe) // no filter given or wanted + { + f = fopen(fileName,"r"); + } + else // use filter + { + QCString cmd=filter+" \""+fileName+"\""; + Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",cmd.data()); + f = portable_popen(cmd,"r"); + } + bool found=vhdlOpt; // for VHDL no bracket search is possible if (f) { int c=0; @@ -584,7 +594,14 @@ static bool readCodeFragment(const char *fileName, endLine=lineNr-1; } } - if (Config_getBool("FILTER_SOURCE_FILES")) pclose(f); else fclose(f); + if (usePipe) + { + portable_pclose(f); + } + else + { + fclose(f); + } } result = transcodeCharacterStringToUTF8(result); return found; diff --git a/src/docsets.cpp b/src/docsets.cpp index 52a3c33..86fe54e 100644 --- a/src/docsets.cpp +++ b/src/docsets.cpp @@ -62,8 +62,11 @@ void DocSets::initialize() "DOCSET_RESOURCES=$(DOCSET_CONTENTS)/Resources\n" "DOCSET_DOCUMENTS=$(DOCSET_RESOURCES)/Documents\n" "DOCSET_INSTALL=~/Library/Developer/Shared/Documentation/DocSets\n" + "XCODE_INSTALL=$(shell xcode-select -print-path)\n" "\n" - "all: always\n" + "all: docset\n" + "\n" + "docset:\n" "\tmkdir -p $(DOCSET_DOCUMENTS)\n" "\tcp Nodes.xml $(DOCSET_RESOURCES)\n" "\tcp Tokens.xml $(DOCSET_RESOURCES)\n" @@ -74,16 +77,16 @@ void DocSets::initialize() "\t --exclude Info.plist \\\n" "\t --exclude Makefile -c -f - . \\\n" "\t | (cd $(DOCSET_DOCUMENTS); tar xvf -)\n" - "\tdocsetutil index $(DOCSET_NAME)\n" + "\t$(XCODE_INSTALL)/usr/bin/docsetutil index $(DOCSET_NAME)\n" "\trm -f $(DOCSET_DOCUMENTS)/Nodes.xml\n" "\trm -f $(DOCSET_DOCUMENTS)/Info.plist\n" "\trm -f $(DOCSET_DOCUMENTS)/Makefile\n" "\trm -f $(DOCSET_RESOURCES)/Nodes.xml\n" "\trm -f $(DOCSET_RESOURCES)/Tokens.xml\n" "\n" - "install:\n" + "install: docset\n" "\tmkdir -p $(DOCSET_INSTALL)\n" - "\tcp -a $(DOCSET_NAME) $(DOCSET_INSTALL)\n" + "\tcp -R $(DOCSET_NAME) $(DOCSET_INSTALL)\n" "\n" "uninstall:\n" "\trm -rf $(DOCSET_INSTALL)\n" diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 2b04453..0d163cd 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -734,7 +734,7 @@ static void addIncludeFile(ClassDef *cd,FileDef *ifd,Entry *root) { // explicit request QCString text; text.sprintf("Warning: the name `%s' supplied as " - "the second argument in the \\class, \\struct, or \\union statement ", + "the argument of the \\class, \\struct, \\union, or \\include command ", root->includeFile.data() ); if (ambig) // name is ambigious @@ -8337,6 +8337,7 @@ void copyAndFilterFile(const char *fileName,BufStr &dest) else { QCString cmd=filterName+" \""+fileName+"\""; + Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",cmd.data()); FILE *f=portable_popen(cmd,"r"); if (!f) { @@ -8884,7 +8885,8 @@ void initDoxygen() ParserInterface *defaultParser = new CLanguageScanner; Doxygen::parserManager = new ParserManager(defaultParser); - Doxygen::parserManager->registerParser(".py",new PythonLanguageScanner); + Doxygen::parserManager->registerParser(".py", new PythonLanguageScanner); + Doxygen::parserManager->registerParser(".f", new FortranLanguageScanner); Doxygen::parserManager->registerParser(".f90", new FortranLanguageScanner); Doxygen::parserManager->registerParser(".vhd", new VHDLLanguageScanner); diff --git a/src/filedef.cpp b/src/filedef.cpp index 5daeb6a..9123976 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -34,6 +34,7 @@ #include "parserintf.h" #include "portable.h" #include "vhdldocgen.h" +#include "debug.h" class DevNullCodeDocInterface : public CodeOutputInterface { @@ -1336,7 +1337,9 @@ void FileDef::acquireFileVersion() if (!vercmd.isEmpty()) { msg("Version of %s : ",filepath.data()); - FILE *f=portable_popen(vercmd+" \""+filepath+"\"","r"); + QCString cmd = vercmd+" \""+filepath+"\""; + Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",cmd.data()); + FILE *f=portable_popen(cmd,"r"); if (!f) { err("Error: could not execute %s\n",vercmd.data()); diff --git a/src/fortrancode.l b/src/fortrancode.l index 63fdb0a..a2a3ad8 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -581,8 +581,8 @@ ARGS {BS}("("[^)]*")"){BS} NUM_TYPE (complex|integer|logical|real) KIND {ARGS} -CHAR (CHARACTER{ARGS}?|CHARACTER{BS}"*"([0-9]+|{ARGS})) -TYPE_SPEC (({NUM_TYPE}("*"[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{BS}PRECISION|{CHAR}) +CHAR (CHARACTER{ARGS}?|CHARACTER{BS}"*"({BS}[0-9]+|{ARGS})) +TYPE_SPEC (({NUM_TYPE}({BS}"*"{BS}[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{B}PRECISION|{CHAR}) INTENT_SPEC intent{BS}"("{BS}(in|out|in{BS}out){BS}")" ATTR_SPEC (ALLOCATABLE|DIMENSION{ARGS}|EXTERNAL|{INTENT_SPEC}|INTRINSIC|OPTIONAL|PARAMETER|POINTER|PRIVATE|PUBLIC|SAVE|TARGET) @@ -630,7 +630,7 @@ IGNORE (IMPLICIT{BS}NONE|CONTAINS|WRITE|READ|ALLOCATE|DEALLOCATE|SIZE) codifyLines(yytext); endFontClass(); } -<Start>"end"{BS}{COMMANDS}/[ \t\n].* { +<Start>"end"({BS_}{COMMANDS})?/[ \t\n].* { startFontClass("keyword"); codifyLines(yytext); endFontClass(); @@ -687,11 +687,11 @@ IGNORE (IMPLICIT{BS}NONE|CONTAINS|WRITE|READ|ALLOCATE|DEALLOCATE|SIZE) yy_pop_state(); REJECT; } -<Start>"end"{BS}"module".* { // just reset currentModule, rest is done in following rule +<Start>"end"({BS_}"module")?.* { // just reset currentModule, rest is done in following rule currentModule=0; REJECT; } -<Start>"end"{BS}("program"|"module"|"type"|"interface") { // +<Start>"end"({BS_}("program"|"module"|"type"|"interface"))? { // endUseScope(); startFontClass("keyword"); codifyLines(yytext); @@ -722,7 +722,7 @@ IGNORE (IMPLICIT{BS}NONE|CONTAINS|WRITE|READ|ALLOCATE|DEALLOCATE|SIZE) <Subprog>"\n" { codifyLines(yytext); yy_pop_state(); } -<Start>"end"{BS}{SUBPROG}.* { // Fortran subroutine or function ends +<Start>"end"({BS_}{SUBPROG})? { // Fortran subroutine or function ends //cout << "===> end function " << yytext << endl; endUseScope(); startFontClass("keyword"); diff --git a/src/fortranscanner.l b/src/fortranscanner.l index 8eddc14..285bc24 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -189,8 +189,8 @@ NOARGS {BS}"\n" NUM_TYPE (complex|integer|logical|real) KIND {ARGS} -CHAR (CHARACTER{ARGS}?|CHARACTER{BS}"*"([0-9]+|{ARGS})) -TYPE_SPEC (({NUM_TYPE}("*"[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{BS}PRECISION|{CHAR}|TYPE{ARGS}) +CHAR (CHARACTER{ARGS}?|CHARACTER{BS}"*"({BS}[0-9]+|{ARGS})) +TYPE_SPEC (({NUM_TYPE}({BS}"*"{BS}[0-9]+)?)|({NUM_TYPE}{KIND})|DOUBLE{BS_}PRECISION|{CHAR}|TYPE{ARGS}) INTENT_SPEC intent{BS}"("{BS}(in|out|in{BS}out){BS}")" ATTR_SPEC (ALLOCATABLE|DIMENSION{ARGS}|EXTERNAL|{INTENT_SPEC}|INTRINSIC|OPTIONAL|PARAMETER|POINTER|PRIVATE|PUBLIC|SAVE|TARGET) @@ -244,7 +244,7 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} <*>"\\\""|\\\' { /* ignore \" and \' */} <String>\"|\' { // string ends with next quote without previous backspace - if(yytext[0]!=stringStartSymbol) REJECT; // single vs double quote + if (yytext[0]!=stringStartSymbol) REJECT; // single vs double quote // fprintf(stderr,"string end: %s\n",debugStr.data()); yy_pop_state(); } @@ -252,7 +252,7 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} <String>. { debugStr+=yytext; } // ignore String contents (especially '!') <*>\"|\' { /* string starts */ - if(YY_START == StrIgnore) REJECT; // ignore in simple comments + if (YY_START == StrIgnore) REJECT; // ignore in simple comments // fprintf(stderr,"string start: %c %d\n",yytext[0],yyLineNr); yy_push_state(YY_START); stringStartSymbol=yytext[0]; // single or double quote @@ -264,7 +264,8 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} <*>"!"/[^<>\n] { if (YY_START == String) REJECT; // "!" is ignored in strings // skip comment line (without docu comments "!>" "!<" ) /* ignore further "!" and ignore comments in Strings */ - if ((YY_START != StrIgnore) && (YY_START != String)) { + if ((YY_START != StrIgnore) && (YY_START != String)) + { yy_push_state(YY_START); BEGIN(StrIgnore); debugStr="*!"; @@ -316,7 +317,7 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} int index = name.find("interface", 0, FALSE); index = name.find(QRegExp("[^ \\t]"), index+9); //printf(stderr,"%s,%d\n",name.data(),index); - if(index!=-1) + if (index!=-1) name = name.right(name.length()-index); else // interface without name, must be inside subprog name = "interface"; @@ -324,8 +325,8 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} yy_push_state(InterfaceBody); startScope(last_entry); } -<InterfaceBody>"end"{BS}"interface".* { - if(!endScope(current_root)) +<InterfaceBody>"end"({BS_}"interface")?.* { + if (!endScope(current_root)) yyterminate(); yy_pop_state(); } @@ -348,9 +349,9 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} BEGIN(Module); defaultProtection = Public; } -<Start,ModuleBody>"end"{BS}(module|program).* { // end module +<Start,ModuleBody>"end"({BS_}(module|program))?.* { // end module resolveModuleProcedures(moduleProcedures, current_root); - if(!endScope(current_root)) + if (!endScope(current_root)) yyterminate(); defaultProtection = Public; BEGIN(Start); @@ -405,15 +406,26 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} startScope(last_entry); BEGIN(TypedefBody); } -<TypedefBody>"end"{BS}"type".* { /* end type definition */ +<TypedefBody>"end"{BS_}"type".* { /* end type definition */ //cout << "=========> got typedef end "<< endl; - if(!endScope(current_root)) + if (!endScope(current_root)) yyterminate(); yy_pop_state(); } /*------- module/global/typedef variable ---------------------------------------------------*/ +<SubprogBody>"end"({BS_}{SUBPROG})?.* { + //cout << "1e=========> got end subprog: " << yytext << endl; + + /* args is used for parameters in list of functions, argList for + parameters in detailed function descripttion */ + //current->args = argListToString(current->argList); + //current->endBodyLine = yyLineNr; // ??? what ist endBodyLine for + if (!endScope(current_root)) + yyterminate(); + yy_pop_state() ; + } <Start,ModuleBody,TypedefBody,SubprogBody>{ {TYPE_SPEC}/{SEPARATE} { /* variable declaration starts */ @@ -429,16 +441,19 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} DefineDict* defines = getFileDefineDict(); QCString name; int index = str.find("("); - if(index != -1) + if (index != -1) name = str.left(index).stripWhiteSpace(); else name = str; Define *define = (*defines)[name]; - if(define != 0 && isTypeName(define->definition)) { + if (define != 0 && isTypeName(define->definition)) + { argType = str; yy_push_state(AttributeList); - } else { + } + else + { REJECT; } } @@ -452,6 +467,8 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} yy_push_state(YY_START); BEGIN( AttributeList ) ; } +{ID} { + } } <AttributeList>{ {COMMA} {} @@ -481,7 +498,8 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} int last= yy_top_state(); v_type= V_IGNORE; - if (!argType.isEmpty() && last != SubprogBody) { // new variable entry + if (!argType.isEmpty() && last != SubprogBody) + { // new variable entry v_type = V_VARIABLE; current->section = Entry::VARIABLE_SEC; current->name = argName; @@ -489,7 +507,9 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} current->fileName = yyFileName; current->bodyLine = yyLineNr; // used for source reference addCurrentEntry(); - } else if(!argType.isEmpty()){ // deklaration of parameter list: add type for corr. parameter + } + else if (!argType.isEmpty()) + { // deklaration of parameter list: add type for corr. parameter parameter= addFortranParameter(argType,argName,docBlock); if (parameter) v_type= V_PARAMETER; // save, it may be function return type @@ -518,14 +538,13 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} docBlock.resize(0); } -<Initialization>"(/" { initializer+=yytext; +<Initialization>"(" { initializer+=yytext; BEGIN(ArrayInitializer); // initializer may contain comma } -<ArrayInitializer>. { initializer+=yytext; } -<ArrayInitializer>"/)" { initializer+=yytext; - yy_pop_state(); // end initialization - if (v_type == V_VARIABLE) last_entry->initializer= initializer; +<ArrayInitializer>")" { initializer+=yytext; + BEGIN(Initialization); } +<ArrayInitializer>. { initializer+=yytext; } <Initialization>{COMMA} { yy_pop_state(); // end initialization if (v_type == V_VARIABLE) last_entry->initializer= initializer; } @@ -569,7 +588,8 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} QCString arglist= yytext; //cout << "3=========> got parameterlist " << yytext << endl; yyLineNr+= arglist.contains('\n'); - arglist = arglist.replace(QRegExp("&[^\n]*\n"),""); + static QRegExp re("&[^\n]*\n"); + arglist = arglist.replace(re,""); //cout << "3=========> got parameterlist " << arglist << endl; current->args = arglist; current->args = removeRedundantWhiteSpace(current->args); @@ -593,17 +613,6 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} modifiers[current_root->parent()][current_root->name.lower()].returnName = result; //cout << "=====> got result " << result << endl; } -<SubprogBody>"end"{BS}{SUBPROG}.* { - //cout << "1e=========> got end subprog: " << yytext << endl; - - /* args is used for parameters in list of functions, argList for - parameters in detailed function descripttion */ - //current->args = argListToString(current->argList); - //current->endBodyLine = yyLineNr; // ??? what ist endBodyLine for - if(!endScope(current_root)) - yyterminate(); - yy_pop_state() ; - } /*---- documentation comments --------------------------------------------------------------------*/ @@ -620,13 +629,15 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} } <DocBackLine>.* { // contents of current comment line docBlock=yytext; - if (v_type == V_VARIABLE) { + if (v_type == V_VARIABLE) + { Entry *tmp_entry = current; current = last_entry; // temporarily switch to the previous entry handleCommentBlock(docBlock,TRUE); current=tmp_entry; } - else if (v_type == V_PARAMETER) { + else if (v_type == V_PARAMETER) + { parameter->docs=docBlock; } yy_pop_state(); @@ -659,9 +670,10 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} /*------------------------------------------------------------------------------------------------*/ -<*>"\n" {yyLineNr++; - //if (debugStr.stripWhiteSpace().length() > 0) cout << "ignored text: " << debugStr << " state: " <<YY_START << endl; - debugStr=""; +<*>"\n" { + yyLineNr++; + //if (debugStr.stripWhiteSpace().length() > 0) cout << "ignored text: " << debugStr << " state: " <<YY_START << endl; + debugStr=""; } /*---- error: EOF in wrong state --------------------------------------------------------------------*/ @@ -670,7 +682,9 @@ ATTR_STMT {ATTR_SPEC}|DIMENSION|{ACCESS_SPEC} scanner_abort(); yyterminate(); } - <*>. {debugStr+=yytext;} // ignore remaining text + <*>. { + debugStr+=yytext; + } // ignore remaining text /**********************************************************************************/ /**********************************************************************************/ @@ -725,12 +739,12 @@ static QCString extractFromParens(const QCString name) { QCString extracted = name; int start = extracted.find("("); - if(start != -1) + if (start != -1) { extracted.remove(0, start+1); } int end = extracted.findRev(")"); - if(end != -1) + if (end != -1) { int length = extracted.length(); extracted.remove(end, length); @@ -743,10 +757,10 @@ static QCString extractFromParens(const QCString name) /*! Adds passed modifiers to these modifiers.*/ SymbolModifiers& SymbolModifiers::operator|=(const SymbolModifiers &mdfs) { - if(mdfs.protection!=NONE_P) protection = mdfs.protection; - if(mdfs.direction!=NONE_D) direction = mdfs.direction; + if (mdfs.protection!=NONE_P) protection = mdfs.protection; + if (mdfs.direction!=NONE_D) direction = mdfs.direction; optional |= mdfs.optional; - if(!mdfs.dimension.isNull()) dimension = mdfs.dimension; + if (!mdfs.dimension.isNull()) dimension = mdfs.dimension; allocatable |= mdfs.allocatable; external |= mdfs.external; intrinsic |= mdfs.intrinsic; @@ -772,9 +786,9 @@ SymbolModifiers& SymbolModifiers::operator|=(QCString mdfString) QCString tmp = extractFromParens(mdfString); bool isin = tmp.contains("in"); bool isout = tmp.contains("out"); - if(isin && isout) newMdf.direction = SymbolModifiers::INOUT; - else if(isin) newMdf.direction = SymbolModifiers::IN; - else if(isout) newMdf.direction = SymbolModifiers::OUT; + if (isin && isout) newMdf.direction = SymbolModifiers::INOUT; + else if (isin) newMdf.direction = SymbolModifiers::IN; + else if (isout) newMdf.direction = SymbolModifiers::OUT; } else if (mdfString=="public") { @@ -796,23 +810,23 @@ SymbolModifiers& SymbolModifiers::operator|=(QCString mdfString) { newMdf.external = TRUE; } - else if(mdfString=="intrinsic") + else if (mdfString=="intrinsic") { newMdf.intrinsic = TRUE; } - else if(mdfString=="parameter") + else if (mdfString=="parameter") { newMdf.parameter = TRUE; } - else if(mdfString=="pointer") + else if (mdfString=="pointer") { newMdf.pointer = TRUE; } - else if(mdfString=="target") + else if (mdfString=="target") { newMdf.target = TRUE; } - else if(mdfString=="save") + else if (mdfString=="save") { newMdf.save = TRUE; } @@ -838,7 +852,7 @@ static Argument *findArgument(Entry* subprog, QCString name, bool byTypeName = F for (unsigned int i=0; i<subprog->argList->count(); i++) { Argument *arg = subprog->argList->at(i); - if(!byTypeName && arg->name.lower() == cname || + if (!byTypeName && arg->name.lower() == cname || byTypeName && arg->type.lower() == cname) return arg; } @@ -856,10 +870,10 @@ static Entry *findFunction(Entry* entry, QCString name) Entry *ce; for (;(ce=eli.current());++eli) { - if(ce->section != Entry::FUNCTION_SEC) + if (ce->section != Entry::FUNCTION_SEC) continue; - if(ce->name.lower() == cname) + if (ce->name.lower() == cname) return ce; } @@ -870,52 +884,52 @@ static Entry *findFunction(Entry* entry, QCString name) /*! Apply modifiers stored in \a mdfs to the \a typeName string. */ static QCString applyModifiers(QCString typeName, SymbolModifiers& mdfs) { - if(!mdfs.dimension.isNull()) + if (!mdfs.dimension.isNull()) { typeName += ","; typeName += mdfs.dimension; } - if(mdfs.direction!=SymbolModifiers::NONE_D) + if (mdfs.direction!=SymbolModifiers::NONE_D) { typeName += ","; typeName += directionStrs[mdfs.direction]; } - if(mdfs.optional) + if (mdfs.optional) { typeName += ","; typeName += "optional"; } - if(mdfs.allocatable) + if (mdfs.allocatable) { typeName += ","; typeName += "allocatable"; } - if(mdfs.external) + if (mdfs.external) { typeName += ","; typeName += "external"; } - if(mdfs.intrinsic) + if (mdfs.intrinsic) { typeName += ","; typeName += "intrinsic"; } - if(mdfs.parameter) + if (mdfs.parameter) { typeName += ","; typeName += "parameter"; } - if(mdfs.pointer) + if (mdfs.pointer) { typeName += ","; typeName += "pointer"; } - if(mdfs.target) + if (mdfs.target) { typeName += ","; typeName += "target"; } - if(mdfs.save) + if (mdfs.save) { typeName += ","; typeName += "save"; @@ -937,9 +951,9 @@ static void applyModifiers(Entry *ent, SymbolModifiers& mdfs) QCString tmp = ent->type; ent->type = applyModifiers(tmp, mdfs); - if(mdfs.protection == SymbolModifiers::PUBLIC) + if (mdfs.protection == SymbolModifiers::PUBLIC) ent->protection = Public; - else if(mdfs.protection == SymbolModifiers::PRIVATE) + else if (mdfs.protection == SymbolModifiers::PRIVATE) ent->protection = Private; } @@ -1013,7 +1027,7 @@ static bool endScope(Entry *scope) continue; Argument *arg = findArgument(scope->parent(), ce->name, TRUE); - if(arg != 0) + if (arg != 0) { // set type of dummy procedure argument to interface arg->name = arg->type; @@ -1029,11 +1043,11 @@ static bool endScope(Entry *scope) Entry *ce; for (;(ce=eli.current());++eli) { - if(ce->section != Entry::VARIABLE_SEC && ce->section != Entry::FUNCTION_SEC) + if (ce->section != Entry::VARIABLE_SEC && ce->section != Entry::FUNCTION_SEC) continue; //cout<<ce->name<<", "<<mdfsMap.contains(ce->name.lower())<<mdfsMap.count()<<endl; - if(mdfsMap.contains(ce->name.lower())) + if (mdfsMap.contains(ce->name.lower())) applyModifiers(ce, mdfsMap[ce->name.lower()]); } } diff --git a/src/groupdef.cpp b/src/groupdef.cpp index de41fe7..af0e83b 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -161,22 +161,32 @@ void GroupDef::addFile(const FileDef *def) fileList->append(def); } -void GroupDef::addClass(const ClassDef *cd) +bool GroupDef::addClass(const ClassDef *cd) { - if (cd->isHidden()) return; - if (Config_getBool("SORT_BRIEF_DOCS")) - classSDict->inSort(cd->name(),cd); - else - classSDict->append(cd->name(),cd); + if (cd->isHidden()) return FALSE; + if (classSDict->find(cd->name())==0) + { + if (Config_getBool("SORT_BRIEF_DOCS")) + classSDict->inSort(cd->name(),cd); + else + classSDict->append(cd->name(),cd); + return TRUE; + } + return FALSE; } -void GroupDef::addNamespace(const NamespaceDef *def) +bool GroupDef::addNamespace(const NamespaceDef *def) { - if (def->isHidden()) return; - if (Config_getBool("SORT_BRIEF_DOCS")) - namespaceSDict->inSort(def->name(),def); - else - namespaceSDict->append(def->name(),def); + if (def->isHidden()) return FALSE; + if (namespaceSDict->find(def->name())==0) + { + if (Config_getBool("SORT_BRIEF_DOCS")) + namespaceSDict->inSort(def->name(),def); + else + namespaceSDict->append(def->name(),def); + return TRUE; + } + return FALSE; } void GroupDef::addDir(const DirDef *def) @@ -926,8 +936,7 @@ void addClassToGroups(Entry *root,ClassDef *cd) GroupDef *gd=0; if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname))) { - gd->addClass(cd); - cd->makePartOfGroup(gd); + if (gd->addClass(cd)) cd->makePartOfGroup(gd); //printf("Compound %s: in group %s\n",cd->name().data(),s->data()); } } @@ -944,8 +953,7 @@ void addNamespaceToGroups(Entry *root,NamespaceDef *nd) //printf("group `%s'\n",s->data()); if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g->groupname))) { - gd->addNamespace(nd); - nd->makePartOfGroup(gd); + if (gd->addNamespace(nd)) nd->makePartOfGroup(gd); //printf("Namespace %s: in group %s\n",nd->name().data(),s->data()); } } diff --git a/src/groupdef.h b/src/groupdef.h index d2f262c..dcbe1e4 100644 --- a/src/groupdef.h +++ b/src/groupdef.h @@ -51,8 +51,8 @@ class GroupDef : public Definition void setGroupTitle( const char *newtitle ); bool hasGroupTitle( ) { return titleSet; } void addFile(const FileDef *def); - void addClass(const ClassDef *def); - void addNamespace(const NamespaceDef *def); + bool addClass(const ClassDef *def); + bool addNamespace(const NamespaceDef *def); void addGroup(const GroupDef *def); void addParentGroup(const GroupDef *def); void addPage(PageDef *def); diff --git a/src/index.cpp b/src/index.cpp index ad8647a..a762ecf 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -2253,7 +2253,7 @@ void writePageIndex(OutputList &ol) } } endIndexHierarchy(ol,0); - Doxygen::indexList.decContentsDepth(); + //Doxygen::indexList.decContentsDepth(); endFile(ol); ol.popGeneratorState(); } @@ -1975,7 +1975,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) <SkipCComment,SkipVerbatim>. { outputChar(*yytext); } -<CopyCComment>[^*]+ { +<CopyCComment>[^*a-z_A-Z]+ { g_defLitText+=yytext; g_defText+=escapeAt(yytext); } @@ -1989,10 +1989,6 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) g_defLitText+=yytext; g_defText+=yytext; } -<CopyCComment>. { - g_defLitText+=yytext; - g_defText+=yytext; - } <RemoveCComment>"*/" { BEGIN(g_lastCContext); } <RemoveCComment>"//" <RemoveCComment>"/*" @@ -2026,7 +2022,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) g_quoteArg=TRUE; g_defLitText+=yytext; } -<DefineText>{ID} { +<DefineText,CopyCComment>{ID} { g_defLitText+=yytext; if (g_quoteArg) { @@ -2059,6 +2055,10 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) } g_quoteArg=FALSE; } +<CopyCComment>. { + g_defLitText+=yytext; + g_defText+=yytext; + } <DefineText>\\[\r]?\n { g_defLitText+=yytext; outputChar('\n'); diff --git a/src/pyscanner.l b/src/pyscanner.l index c8857da..b70c448 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -311,7 +311,7 @@ static void handleCommentBlock(const QCString &doc,bool brief) yyFileName, // file brief ? current->briefLine : current->docLine, // line of block start docBlockInBody ? FALSE : brief, - FALSE, //docBlockJavaStyle, // javadoc style + docBlockJavaStyle, // javadoc style // or FALSE, docBlockInBody, protection, position, diff --git a/src/scanner.l b/src/scanner.l index 3f86c2f..50edea9 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -3143,7 +3143,8 @@ TYPEDEFPREFIX (("typedef"{BN}+)?)((("volatile"|"const"){BN}+)?) // -> omit typedef and use S_t as the struct name if (typedefHidesStruct && isTypedef && - (current->spec&(Entry::Struct|Entry::Union)) && + ((current->spec&(Entry::Struct|Entry::Union)) || + current->section==Entry::ENUM_SEC )&& msType.stripWhiteSpace().isEmpty() && memspecEntry) { diff --git a/src/util.cpp b/src/util.cpp index 5f52d40..d2e9593 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1465,6 +1465,20 @@ static bool findOperator(const QCString &s,int i) return TRUE; } +static bool findOperator2(const QCString &s,int i) +{ + int b = s.findRev("operator",i); + if (b==-1) return FALSE; // not found + b+=8; + while (b<i) // check if there are only non-ascii + // characters in front of the operator + { + if (isId((uchar)s.at(b))) return FALSE; + b++; + } + return TRUE; +} + static const char constScope[] = { 'c', 'o', 'n', 's', 't', ':' }; static const char virtualScope[] = { 'v', 'i', 'r', 't', 'u', 'a', 'l', ':' }; @@ -1599,7 +1613,12 @@ nextChar: if (c=='*' || c=='&' || c=='@' || c=='$') { uint rl=result.length(); - if (rl>0 && (isId(result.at(rl-1)) || result.at(rl-1)=='>')) result+=' '; + if ((rl>0 && (isId(result.at(rl-1)) || result.at(rl-1)=='>')) && + (c!='*' || !findOperator2(s,i)) // avoid splitting operator* and operator->* + ) + { + result+=' '; + } } result+=c; if (cliSupport && (c=='^' || c=='%') && i>1 && isId(s.at(i-1))) result+=' '; // C++/CLI: Type^ name and Type% name @@ -2141,6 +2160,7 @@ QCString fileToString(const char *name,bool filter) else // filter the input { QCString cmd=filterName+" \""+name+"\""; + Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",cmd.data()); FILE *f=portable_popen(cmd,"r"); if (!f) { @@ -6270,6 +6290,7 @@ SrcLangExt getLanguageFromFileName(const QCString fileName) extLookup.insert(".M", new int(SrcLangExt_ObjC)); extLookup.insert(".mm", new int(SrcLangExt_ObjC)); extLookup.insert(".py", new int(SrcLangExt_Python)); + extLookup.insert(".f", new int(SrcLangExt_F90)); extLookup.insert(".f90", new int(SrcLangExt_F90)); extLookup.insert(".vhd", new int(SrcLangExt_VHDL)); extLookup.insert(".vhdl", new int(SrcLangExt_VHDL)); diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index 60a49b1..0fbd1b4 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -144,13 +144,13 @@ QCString* VhdlDocGen::findKeyWord(const QCString& word) if (word.isEmpty() || word.at(0)=='\0') return 0; //printf("VhdlDocGen::findKeyWord(%s)\n",word.data()); - if (g_vhdlKeyDict0.find(word)) + if (g_vhdlKeyDict0.find(word.lower())) return &g_vhdlkeyword; - if (g_vhdlKeyDict1.find(word)) + if (g_vhdlKeyDict1.find(word.lower())) return &g_vhdltype; - if (g_vhdlKeyDict2.find(word)) + if (g_vhdlKeyDict2.find(word.lower())) return &g_vhdllogic; return 0; @@ -832,21 +832,23 @@ bool VhdlDocGen::getSigTypeName(QList<QCString>& ql, const char* str,QCString& b bool VhdlDocGen::getSigName(QList<QCString>& ql, const char* str,QCString& buffer) { - int len,j,ll,index; + int j,ll,index; char *signal = "signal "; QCString qmem; QCString temp(str); QCString st(str); - QRegExp semi(","); - QRegExp r(":"); - j = r.match(temp.data(),0,&len); + //QRegExp semi(","); + //QRegExp r(":"); + + // colon position + j = temp.find(':'); if (j < 0) return FALSE; // no input definition - st=st.left(j); + st=st.left(j); // name only index=st.find(signal,0,FALSE); - if (index > -1) + if (index > -1) // found "signal " { - qmem=st.remove(index,strlen(signal)); + qmem=st.remove(index,strlen(signal)); // strip it temp=qmem; st=qmem; } @@ -855,56 +857,71 @@ bool VhdlDocGen::getSigName(QList<QCString>& ql, qmem=temp; } - ll=semi.match(st.data(),0,&len); + ll=st.find(','); - if (ll>0) + if (ll>0) // multiple names { while (TRUE) { - st=st.left(ll); + st=st.left(ll).stripWhiteSpace(); // one name + QCString *sig =new QCString(st); ql.insert(0,sig); - qmem=qmem.right(qmem.length()-ll-1); - st=qmem; - ll=semi.match(st.data(),0,&len); - if (ll<0) + qmem=qmem.right(qmem.length()-ll-1); // strip from list + st=qmem; // remainder + ll=st.find(','); + if (ll<0) // last name { - ll = r.match(st.data(),0,&len); - st=st.left(ll); + ll = st.find(':'); + st=st.left(ll).stripWhiteSpace(); ql.insert(0,new QCString(st)); break; } } } - else + else // single name { - st=st.left(j); + st=st.stripWhiteSpace(); ql.insert(0,new QCString(st)); } QCString *qdir=new QCString(str); - st=qdir->mid(j+1); - //st=st.lower(); - st=st.stripWhiteSpace(); + st=qdir->mid(j+1); // part after : + st=st.lower().stripWhiteSpace(); *qdir=st; - ql.insert(0,qdir); + if (st.stripPrefix("inout")) { buffer+="inout"; return TRUE; } + if (st.stripPrefix("INOUT")) + { + buffer+="inout"; + return TRUE; + } if (st.stripPrefix("out")) { buffer+="out"; return TRUE; } + if (st.stripPrefix("OUT")) + { + buffer+="out"; + return TRUE; + } if (st.stripPrefix("in")) { buffer+="in"; return TRUE; } + if (st.stripPrefix("IN")) + { + buffer+="in"; + return TRUE; + } return FALSE; } diff --git a/src/vhdlscanner.l b/src/vhdlscanner.l index 54a75a6..f669188 100644 --- a/src/vhdlscanner.l +++ b/src/vhdlscanner.l @@ -247,6 +247,7 @@ void addSignals(const char* str,int line, Entry *e,const char *comment=0) for (int k=1;k<count;k++) { + printf("adding '%s' '%s'\n",ql.at(0)->data(),ql.at(k)->data()); Entry *pTemp=new Entry; initEntry(pTemp); pTemp->startLine = line; |